[Haskell-cafe] A home-brew iteration-alike library: some extension quiestions

oleg at okmij.org oleg at okmij.org
Mon Dec 13 05:37:26 CET 2010

Just for the record: the library IterateeM.hs, uses NO extensions to
Haskell98, let alone Haskell2010. The library as written requires
LowLevelIO.hs, which uses FFI (which has been Haskell98 addendum and
is in proper Haskell2010). The sample code, Wc.hs, for example, is
Haskell98. So, the iteratee can be written with no extensions

In particular, IterateeM does not use any monad transformer library
(although it could have). I found that the trouble of writing a state
monad for a particular state is negligible compared to the pain of
choosing a particular monad transformer library, and especially the
pain inflicted on the users who have to deal with many a conflicts of
monad transformer libraries.

> The problem was that I wished Zippee. It means that external enumerator
> must be "suspended" at some points so Zippee can process elements from
> both left and right streams in desired order. It makes any other
> approach I considered impossible to use.

The file IterateeN.hs demonstrates zipping two streams together (in
lock-step and not in-lockstep). It turns out, the existing Iteratee
interface and type suffices. This is described in more detail in:

Parallel composition of iteratees: one source to several sinks

Parallel composition of streams: several sources to one sink

More information about the Haskell-Cafe mailing list