Safe Haskell | None |
---|

Element-agnostic grouping utilities for `pipes`

See Pipes.Group.Tutorial for an extended tutorial

- groupsBy :: Monad m => (a' -> a' -> Bool) -> Lens (Producer a' m x) (Producer a m x) (FreeT (Producer a' m) m x) (FreeT (Producer a m) m x)
- groups :: (Monad m, Eq a') => Lens (Producer a' m x) (Producer a m x) (FreeT (Producer a' m) m x) (FreeT (Producer a m) m x)
- chunksOf :: Monad m => Int -> Lens (Producer a' m x) (Producer a m x) (FreeT (Producer a' m) m x) (FreeT (Producer a m) m x)
- takes :: (Functor f, Monad m) => Int -> FreeT f m () -> FreeT f m ()
- takes' :: Monad m => Int -> FreeT (Producer a m) m x -> FreeT (Producer a m) m x
- drops :: Monad m => Int -> FreeT (Producer a m) m x -> FreeT (Producer a m) m x
- maps :: (Monad m, Functor g) => (forall r. f r -> g r) -> FreeT f m x -> FreeT g m x
- individually :: (Monad m, Functor g) => Setter (FreeT f m x) (FreeT g m x) (f (FreeT f m x)) (g (FreeT f m x))
- concats :: Monad m => FreeT (Producer a m) m x -> Producer a m x
- intercalates :: Monad m => Producer a m () -> FreeT (Producer a m) m x -> Producer a m x
- folds :: Monad m => (x -> a -> x) -> x -> (x -> b) -> FreeT (Producer a m) m r -> Producer b m r
- foldsM :: Monad m => (x -> a -> m x) -> m x -> (x -> m b) -> FreeT (Producer a m) m r -> Producer b m r
- module Control.Monad.Trans.Class
- module Control.Monad.Trans.Free
- module Pipes

# Lenses

groupsBy :: Monad m => (a' -> a' -> Bool) -> Lens (Producer a' m x) (Producer a m x) (FreeT (Producer a' m) m x) (FreeT (Producer a m) m x)Source

groups :: (Monad m, Eq a') => Lens (Producer a' m x) (Producer a m x) (FreeT (Producer a' m) m x) (FreeT (Producer a m) m x)Source

chunksOf :: Monad m => Int -> Lens (Producer a' m x) (Producer a m x) (FreeT (Producer a' m) m x) (FreeT (Producer a m) m x)Source

# Transformations

takes :: (Functor f, Monad m) => Int -> FreeT f m () -> FreeT f m ()Source

`(takes n)`

only keeps the first `n`

functor layers of a `FreeT`

You can think of this as:

takes :: (Functor f, Monad m) => Int -> FreeT (Producer a m) m () -> FreeT (Producer a m) m ()

maps :: (Monad m, Functor g) => (forall r. f r -> g r) -> FreeT f m x -> FreeT g m xSource

Transform each individual functor layer of a `FreeT`

You can think of this as:

maps :: (forall r . Producer a m r -> Producer b m r) -> FreeT (Producer a m) m x -> FreeT (Producer b m) m x

This is just a synonym for `transFreeT`

individually :: (Monad m, Functor g) => Setter (FreeT f m x) (FreeT g m x) (f (FreeT f m x)) (g (FreeT f m x))Source

Lens to transform each individual functor layer of a `FreeT`

over individually = maps -- ... with a less general type

# Joiners

# Folds

These folds are designed to be compatible with the `foldl`

library. See
the `purely`

and `impurely`

functions from that
library for more details.

For example, to count the number of `Producer`

layers in a `FreeT`

, you can
write:

import Control.Applicative (pure) import qualified Control.Foldl as L import Pipes.Group import qualified Pipes.Prelude as P count :: Monad m => FreeT (Producer a m) m () -> m Int count = P.sum . L.purely folds (pure 1)

# Re-exports

Control.Monad.Trans.Class re-exports `lift`

.

Control.Monad.Trans.Free re-exports `FreeF`

and `FreeT`

module Control.Monad.Trans.Class

module Control.Monad.Trans.Free

module Pipes