Equations
- IO.Channel.instInhabitedState = { default := { values := default, consumers := default, closed := default } }
FIFO channel with unbounded buffer, where recv?
returns a Task
.
A channel can be closed. Once it is closed, all send
s are ignored, and
recv?
returns none
once the queue is empty.
Equations
- IO.Channel α = IO.Mutex (IO.Channel.State α)
Instances For
Sends a message on an Channel
.
This function does not block.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Closes an Channel
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Receives a message, without blocking. The returned task waits for the message. Every message is only received once.
Returns none
if the channel is closed and the queue is empty.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ch.forAsync f
calls f
for every messages received on ch
.
Note that if this function is called twice, each forAsync
only gets half the messages.
Receives all currently queued messages from the channel.
Those messages are dequeued and will not be returned by recv?
.
Equations
- ch.recvAllCurrent = IO.Mutex.atomically ch (modifyGet fun (st : IO.Channel.State α) => (st.values.toArray, { values := ∅, consumers := st.consumers, closed := st.closed }))
Instances For
Synchronously receives a message from the channel.
Every message is only received once.
Returns none
if the channel is closed and the queue is empty.
Equations
- ch.recv? = do let __do_lift ← IO.Channel.recv? ch IO.wait __do_lift
Instances For
for msg in ch.sync do ...
receives all messages in the channel until it is closed.
Equations
- IO.instForInSyncOfMonadLiftTBaseIO = { forIn := fun {β : Type} [Monad m] (ch : IO.Channel.Sync α) (b : β) (f : α → β → m (ForInStep β)) => IO.Channel.Sync.forIn✝ ch f b }