iteratee New Iteratee: foldChunksM

Michael Baikov manpacket at
Fri Aug 12 06:44:42 BST 2011

It might be useful to have foldChunksM (implementation included at the
bottom) along with foldM to complement
the pair of mapChunksM_ with mapM_

foldChunksM :: (Monad m, Nullable s) => (a -> s -> m a) -> a -> Iteratee s m a
foldChunksM f = liftI . go
        go a (Chunk c) = lift (f a c) >>= liftI . go
        go a e = idone a e

More information about the Iteratee mailing list