piped-0.1.0.0: Conduit with a smaller core

Safe HaskellSafe
LanguageHaskell2010

Piped.Compose

Contents

Description

Pipe composition can be supply or demand driven, which refers to how the pipeline is initiated. Supply driven initiates the left side first.

When a pipe terminates, one side must return a value. Unless the pipeline is run in resumable mode, the other sides may never "complete" in that they do not return a value. If they allocate resources, MonadResource or similar should be used to handle cleanup (see bracketPipe).

Right hand termination works by indicating that no more values are available.

In a mode where either side can return a value, no special termination logic is invoked, execution ends the first time a side returns.

Left termination is not provided; since there is no way to indicate to the left side that the right has terminated, and potential solutions involve discarding values. However, the "either" modes are also suitable for left termination.

Synopsis

Operators

(.|) :: Monad m => Pipe i e m () -> Pipe e o m b -> Pipe i o m b Source #

Demand driven; same as 'composeDemand

(|.) :: Monad m => Pipe i e m a -> Pipe e o m a -> Pipe i o m a Source #

Supply driven; same as 'composeSupplyEither

Demand driven

The right hand side is run first. The left hand side is only invoked by calling await.

composeDemand :: Monad m => Pipe i e m () -> Pipe e o m b -> Pipe i o m b Source #

The right side is run first, only the right side may return a value.

composeDemandEither :: Monad m => Pipe i e m a -> Pipe e o m a -> Pipe i o m a Source #

The right side is run first, either side may return a value.

Supply driven

The left hand side is run first. If it returns immediately, the right hand side is invoked only in the case of composeSupply.

composeSupply :: Monad m => Pipe i e m () -> Pipe e o m b -> Pipe i o m b Source #

The left side is run first, only the right side may return a value.

composeSupplyEither :: Monad m => Pipe i e m a -> Pipe e o m a -> Pipe i o m a Source #

The left side is run first, either side may return a value.