pipes-2.4.0: Compositional pipelines

Safe HaskellSafe
LanguageHaskell2010

Control.Proxy.Pipe

Contents

Description

This module provides an API compatible with Control.Pipe

Consult Control.Pipe.Core for more extensive documentation and Control.Pipe.Tutorial for an extended tutorial.

Synopsis

Types

type Pipe a b = Proxy () a () b Source #

The type variables of Pipe a b m r signify:

  • a - The type of input received from upstream pipes
  • b - The type of output delivered to downstream pipes
  • m - The base monad
  • r - The type of the return value

type Producer b = Pipe () b Source #

A pipe that produces values

type Consumer a = Pipe a C Source #

A pipe that consumes values

type Pipeline = Pipe () C Source #

A self-contained pipeline that is ready to be run

Create Pipes

await :: Monad m => Pipe a b m a Source #

Wait for input from upstream

await blocks until input is available

yield :: Monad m => b -> Pipe a b m () Source #

Deliver output downstream

yield restores control back downstream and binds the result to await.

pipe :: Monad m => (a -> b) -> Pipe a b m r Source #

Convert a pure function into a pipe

Compose Pipes

(<+<) :: Monad m => Pipe b c m r -> Pipe a b m r -> Pipe a c m r infixr 9 Source #

Corresponds to (<<<)/(.) from Control.Category

(>+>) :: Monad m => Pipe a b m r -> Pipe b c m r -> Pipe a c m r infixl 9 Source #

Corresponds to (>>>) from Control.Category

idP :: Monad m => Pipe a a m r Source #

Corresponds to id from Control.Category

Run Pipes

runPipe :: Monad m => Pipeline m r -> m r Source #

Run the Pipe monad transformer, converting it back to the base monad