pipes-extra-0.0.1: Pipes utilities

Control.Pipe.Combinators

Description

Basic pipe combinators.

Synopsis

Documentation

($$) :: Monad m => Producer a m r' -> Consumer a m r -> m (Maybe r)

Connect producer to consumer, ignoring producer return value.

fromList :: Monad m => [a] -> Pipe x a m ()

Successively yield elements of a list.

nullP :: Monad m => Pipe a b m ()

A pipe that terminates immediately.

fold :: Monad m => (b -> a -> b) -> b -> Pipe a x m b

A fold pipe. Apply a binary function to successive input values and an accumulator, and return the final result.

consume :: Monad m => Pipe a x m [a]

Accumulate all input values into a list.

take :: Monad m => Int -> Pipe a a m ()

Act as an identity for the first n values, then terminate.

drop :: Monad m => Int -> Pipe a a m r

Remove the first n values from the stream, then act as an identity.

pipeList :: Monad m => (a -> [b]) -> Pipe a b m r

Apply a function with multiple return values to the stream.

takeWhile :: Monad m => (a -> Bool) -> Pipe a a m a

Act as an identity until as long as inputs satisfy the given predicate. Return the first element that doesn't satisfy the predicate.

takeWhile_ :: Monad m => (a -> Bool) -> Pipe a a m ()

Variation of takeWhile returning ().

dropWhile :: Monad m => (a -> Bool) -> Pipe a a m r

Remove inputs as long as they satisfy the given predicate, then act as an identity.

intersperse :: Monad m => (a -> Bool) -> Pipe a (Maybe a) m r

Yield Nothing when an input satisfying the predicate is received.

groupBy :: Monad m => (a -> a -> Bool) -> Pipe a [a] m r

Group input values by the given predicate.

filter :: Monad m => (a -> Bool) -> Pipe a a m r

Remove values from the stream that don't satisfy the given predicate.