generator-0.5.1: A list monad transformer and related functions.



A monad transformer for the [partial] consumption of Lists. The interface closely mimics iterators in languages such as Python.

It is often nicer to avoid using Consumer and to use folds and higher-order functions instead.



data ConsumerT v m a Source

A monad tranformer for consuming Lists.


evalConsumerT :: List l => ConsumerT v (ItemM l) a -> l v -> ItemM l aSource

Consume a ListT

next :: Monad m => ConsumerT v m (Maybe v)Source

Consume/get the next value

consumeRestM :: Monad m => ConsumerT a m b -> ConsumerT a m (m b)Source

Return an instance of the underlying monad that will use the given ConsumerT to consume the remaining values. After this action there are no more items to consume (they belong to the given ConsumerT now)