Alternative implementation of the pipes concept.
The Pipe type is Pipe lo a b u m r
, where:
lo
is eitherLeftovers
orNoLeftovers
a
is the input typeb
is the output typeu
is the upstream return typem
is the base monadr
is the return type
The primitive stream operations are:
tryAwait
waits for upstreamyield
or terminationyield
yields a value to downstream
The await
operation is provided via EitherT
, and a corresponding withAwait
to
unwrap the EitherT
at the top level.
Exceptions and finalization are to be decided.
Note that simulatePipe
is the fundamental abstraction for running a Pipe
. The more
widely known runPipe
is provided as a specialization.