def timeout.won

bend-kit-concurrency@0.2.0.0 · concurrency.bend:324

import bend-kit-concurrency@0.2.0.0/concurrency.bend as Concurrency
import Base

324def timeout.won(-A: Type, +c: Chan(Maybe<&1, A>), got: Maybe<&1, Maybe<&1, A>>) ->
325  IO(Maybe<&1, A>):
326  match got:
327    case None{}:
328      IO.pure(Maybe<&1, A>, None{})
329    case Some{m}:
330      do IO<Maybe<&1, A>>:
331        Chan.close(Maybe<&1, A>, c)
332        return m

Uses (7)

Used by (1)