Portability | portable |
---|---|

Maintainer | jmillikin@gmail.com |

This module is intended to be imported qualified:

import qualified Data.Enumerator.List as EL

Since: 0.4.5

- fold :: Monad m => (b -> a -> b) -> b -> Iteratee a m b
- foldM :: Monad m => (b -> a -> m b) -> b -> Iteratee a m b
- map :: Monad m => (ao -> ai) -> Enumeratee ao ai m b
- mapM :: Monad m => (ao -> m ai) -> Enumeratee ao ai m b
- concatMap :: Monad m => (ao -> [ai]) -> Enumeratee ao ai m b
- concatMapM :: Monad m => (ao -> m [ai]) -> Enumeratee ao ai m b
- iterate :: Monad m => (a -> a) -> a -> Enumerator a m b
- iterateM :: Monad m => (a -> m a) -> a -> Enumerator a m b
- repeat :: Monad m => a -> Enumerator a m b
- repeatM :: Monad m => m a -> Enumerator a m b
- replicate :: Monad m => Integer -> a -> Enumerator a m b
- replicateM :: Monad m => Integer -> m a -> Enumerator a m b
- generateM :: Monad m => m (Maybe a) -> Enumerator a m b
- unfold :: Monad m => (s -> Maybe (a, s)) -> s -> Enumerator a m b
- unfoldM :: Monad m => (s -> m (Maybe (a, s))) -> s -> Enumerator a m b
- filter :: Monad m => (a -> Bool) -> Enumeratee a a m b
- filterM :: Monad m => (a -> m Bool) -> Enumeratee a a m b
- take :: Monad m => Integer -> Iteratee a m [a]
- takeWhile :: Monad m => (a -> Bool) -> Iteratee a m [a]
- consume :: Monad m => Iteratee a m [a]
- head :: Monad m => Iteratee a m (Maybe a)
- drop :: Monad m => Integer -> Iteratee a m ()
- dropWhile :: Monad m => (a -> Bool) -> Iteratee a m ()
- require :: Monad m => Integer -> Iteratee a m ()
- isolate :: Monad m => Integer -> Enumeratee a a m b
- splitWhen :: Monad m => (a -> Bool) -> Enumeratee a [a] m b

# List analogues

## Folds

fold :: Monad m => (b -> a -> b) -> b -> Iteratee a m bSource

Consume the entire input stream with a strict left fold, one element at a time.

Since: 0.4.8

foldM :: Monad m => (b -> a -> m b) -> b -> Iteratee a m bSource

Consume the entire input stream with a strict monadic left fold, one element at a time.

Since: 0.4.8

## Maps

map :: Monad m => (ao -> ai) -> Enumeratee ao ai m bSource

applies `map`

f*f* to each input element and feeds the
resulting outputs to the inner iteratee.

Since: 0.4.8

mapM :: Monad m => (ao -> m ai) -> Enumeratee ao ai m bSource

applies `mapM`

f*f* to each input element and feeds the
resulting outputs to the inner iteratee.

Since: 0.4.8

concatMap :: Monad m => (ao -> [ai]) -> Enumeratee ao ai m bSource

applies `concatMap`

f*f* to each input element and feeds the
resulting outputs to the inner iteratee.

Since: 0.4.8

concatMapM :: Monad m => (ao -> m [ai]) -> Enumeratee ao ai m bSource

applies `concatMapM`

f*f* to each input element and feeds the
resulting outputs to the inner iteratee.

Since: 0.4.8

## Infinite streams

iterate :: Monad m => (a -> a) -> a -> Enumerator a m bSource

iterateM :: Monad m => (a -> m a) -> a -> Enumerator a m bSource

Similar to `iterate`

, except the iteration function is monadic.

Since: 0.4.8

repeat :: Monad m => a -> Enumerator a m bSource

repeatM :: Monad m => m a -> Enumerator a m bSource

Enumerates an infinite stream of element. Each element is computed by the underlying monad.

Since: 0.4.8

## Bounded streams

replicate :: Monad m => Integer -> a -> Enumerator a m bSource

replicateM :: Monad m => Integer -> m a -> Enumerator a m bSource

enumerates a stream of `replicateM`

n m_x*n* elements, with each
element computed by *m_x*.

Since: 0.4.8

generateM :: Monad m => m (Maybe a) -> Enumerator a m bSource

unfold :: Monad m => (s -> Maybe (a, s)) -> s -> Enumerator a m bSource

Enumerates a stream of elements by repeatedly applying a function to some state.

Similar to `iterate`

.

Since: 0.4.8

unfoldM :: Monad m => (s -> m (Maybe (a, s))) -> s -> Enumerator a m bSource

Enumerates a stream of elements by repeatedly applying a computation to some state.

Similar to `iterateM`

.

Since: 0.4.8

## Filters

filter :: Monad m => (a -> Bool) -> Enumeratee a a m bSource

Applies a predicate to the stream. The inner iteratee only receives
elements for which the predicate is `True`

.

Since: 0.4.8

filterM :: Monad m => (a -> m Bool) -> Enumeratee a a m bSource

Applies a monadic predicate to the stream. The inner iteratee only
receives elements for which the predicate returns `True`

.

Since: 0.4.8

## Consumers

take :: Monad m => Integer -> Iteratee a m [a]Source

extracts the next `take`

n*n* elements from the stream, as a list.

Since: 0.4.5

takeWhile :: Monad m => (a -> Bool) -> Iteratee a m [a]Source

extracts input from the stream until the first element
which does not match the predicate.
`takeWhile`

p

Since: 0.4.5

## Unsorted

head :: Monad m => Iteratee a m (Maybe a)Source

Get the next element from the stream, or `Nothing`

if the stream has
ended.

Since: 0.4.5

drop :: Monad m => Integer -> Iteratee a m ()Source

ignores `drop`

n*n* input elements from the stream.

Since: 0.4.5

dropWhile :: Monad m => (a -> Bool) -> Iteratee a m ()Source

ignores input from the stream until the first element
which does not match the predicate.
`dropWhile`

p

Since: 0.4.5

require :: Monad m => Integer -> Iteratee a m ()Source

buffers input until at least `require`

n*n* elements are available, or
throws an error if the stream ends early.

Since: 0.4.5

isolate :: Monad m => Integer -> Enumeratee a a m bSource

reads at most `isolate`

n*n* elements from the stream, and passes them
to its iteratee. If the iteratee finishes early, elements continue to be
consumed from the outer stream until *n* have been consumed.

Since: 0.4.5

splitWhen :: Monad m => (a -> Bool) -> Enumeratee a [a] m bSource

Split on elements satisfying a given predicate.

Since: 0.4.8