package fiber

  1. Overview
  2. Docs

Destructive streams that can be composed to pipelines.

Streams can be finite or infinite. Streams have no storage and can only have one writer and/or one reader at any given time. If you'd like to access a stream concurrently, you need to protect it via a mutex.

Trying to access the same side of a stream concurrently will result in an error.

module In : sig ... end
module Out : sig ... end
val connect : 'a In.t -> 'a Out.t -> unit fiber

connect i o reads from i and writes to o. Closes o when i is exhausted. Returned fiber terminates when i is exhausted

val supply : 'a In.t -> 'a Out.t -> unit fiber

supply i o like connect i o but does not close o once i is exhausted, allowing more values to be pused to o. Returned fiber terminates when i is exhausted

val pipe : unit -> 'a In.t * 'a Out.t

pipe () returns (i, o) where values pushed through o can be read through i.