pipes-core-0.0.1: Compositional pipelines

Safe HaskellSafe-Infered

Control.Pipe.Monoidal

Synopsis

Documentation

The combinators in this module allow you to create and manipulate multi-channel pipes. Multiple input or output channels are represented with Either types.

Most of the combinators are generalizations of the corresponding functions in Arrow, and obey appropriately generalized laws.

firstP :: Monad m => Pipe a b m r -> Pipe (Either a c) (Either b c) m rSource

Create a Pipe that behaves like the given Pipe of the left component of the input, and lets values in the right component pass through.

secondP :: Monad m => Pipe a b m r -> Pipe (Either c a) (Either c b) m rSource

This function is the equivalent of firstP for the right component.

(***) :: Monad m => Pipe a b m r -> Pipe a' b' m r -> Pipe (Either a a') (Either b b') m rSource

Combine two pipes into a single pipe that behaves like the first on the left component, and the second on the right component.

associateP :: Monad m => Pipe (Either (Either a b) c) (Either a (Either b c)) m rSource

Convert between the two possible associations of a triple sum.

disassociateP :: Monad m => Pipe (Either a (Either b c)) (Either (Either a b) c) m rSource

Inverse of associateP.

discardL :: Monad m => Pipe (Either x a) a m rSource

Discard all values on the left component.

discardR :: Monad m => Pipe (Either a x) a m rSource

Discard all values on the right component.

swapP :: Monad m => Pipe (Either a b) (Either b a) m rSource

Swap the left and right components.

joinP :: Monad m => Pipe (Either a a) a m rSource

Yield both components of input values into the output.

splitP :: Monad m => Pipe a (Either a a) m rSource

Yield all input values into both the left and right components of the output.

loopP :: Monad m => Pipe (Either a c) (Either b c) m r -> Pipe a b m rSource

The loopP combinator allows to create Pipes whose output value is fed back to the Pipe as input.