Idris2Doc : IO.Async.Channel

IO.Async.Channel

(source)

Definitions

dataSendRes : Type
Totality: total
Visibility: public export
Constructors:
Sent : SendRes
SentAndClosed : SendRes
Closed : SendRes

Hints:
EqSendRes
OrdSendRes
ShowSendRes
recordChannel : Type->Type
  A concurrent, bounded channel holding values of type `a`.

This is an important primitive for implementing single
consumer, multiple producer services.

Note: Unlike with `IO.Async.BQueue`, which can have multiple
consumers, this will only accpet a single consumer,
silently overwriting an old consumer in case a new one
calls.

Totality: total
Visibility: export
Constructor: 
C : IORef (STa) ->Channela

Projection: 
.ref : Channela->IORef (STa)
channel : Lift1Worldf=>Nat->f (Channela)
  Creates a new bounded queue of the given capacity.

Totality: total
Visibility: export
channelOf : Lift1Worldf=> (0a : Type) ->Nat->f (Channela)
  Utility alias for `channel` taking the type of stored values
as an explicit argument.

Totality: total
Visibility: export
send : Channela->a->AsynceesSendRes
  Sends a value through a channel potentially blocking the
calling fiber until there is some capacity.

This returns
* `Sent` if the data was received and the channel is still open after sending
* `SentAndClosed` if the data was received and the channel is now closed
* `Closed` if the data could not be sent since the channel is closed.

Totality: total
Visibility: export
receive : Channela->Asyncees (Maybea)
  Extracts the next value from a channel potentially blocking
the calling fiber until such a value is available.

This returns `Nothing` if the channel has been closed and
no pending values are left.

Totality: total
Visibility: export
close : Channela->Asyncees ()
  Gracefully closes the channel: No more data can be sent
(`send` will return immedately with `Closed` from now on),
put pending data can still be received.

Totality: total
Visibility: export