conduit-extra-0.1.6: Experimental helper functions for conduit.

Safe HaskellNone

Data.Conduit.Extra.Pipes

Description

Provides a convenience layer on top of conduit with functions and operators similar to the pipes library.

Synopsis

Documentation

(>->) :: forall a b i o m. Monad m => ConduitM i a m () -> ConduitM a o m b -> ConduitM i o m bSource

The conduit composition operator, ala pipes. When combined with runPipe (or runEffect, if you prefer), this is the only operator needed.

(<-<) :: forall a b i o m. Monad m => ConduitM a o m b -> ConduitM i a m () -> ConduitM i o m bSource

runPipe :: forall m b. Monad m => ConduitM () Void m b -> m bSource

Run a conduit. This name may be preferable to the overly generic runEffect, which pipes uses.

runPipeR :: forall m b. (MonadBaseControl IO m, Monad m) => ConduitM () Void (ResourceT m) b -> m bSource

Like runPipe, except implies a call to runResourceT, for running resource-sensitive pipelines.

runEffect :: forall m b. Monad m => ConduitM () Void m b -> m bSource

forP :: Monad m => Source m a -> (a -> m ()) -> m ()Source

Iterate over all the elements from source, similar to forM for a monad.

each :: (Monad m, Foldable f) => f a -> Producer m aSource

Call yield for each element of the Foldable data structure, resulting in a Producer over these elements.

>>> runPipe $ forP (each [1..3]) $ liftIO . print
1
2
3

take :: Monad m => Int -> Conduit a m aSource

Take N items from a conduit. Synonym for Conduit's isolate.

peel :: Monad m => Int -> m [()]Source

Peel off N items from a conduit and return them. Synonym for Conduit's take.

replicateM :: Monad m => Int -> m a -> Producer m aSource

Replicate a monadic action a given number of times via a producer.

tee :: Monad m => Sink a (ConduitM a a m) b -> ConduitM a a m bSource

Injects a sink within a pipeline which receives a copy of every input argument, similar to the Unix command of the same name.

>>> runPipe $ each [1..3] >-> tee (P.mapM_ f) >-> P.mapM_ f
1
1
2
2
3
3