jon.recoil.org

Module Flambda2_algorithms.Channel

Channels

A channel is really just a reference, but we use separate sender and receiver types to indicate whether we expect to only write or only read to a specific reference.

type 'a sender
val send : 'a sender -> 'a -> unit
type 'a receiver
val recv : 'a receiver -> 'a
val create : 'a -> 'a sender * 'a receiver

Create a pair sender, receiver.

The value read (using recv) from the receiver is the last value that was sent (using send) to the sender, or the initial value provided to channel.