[Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

Felipe Almeida Lessa felipe.lessa at gmail.com
Fri May 6 15:10:26 CEST 2011

On Fri, May 6, 2011 at 6:46 AM, David Virebayre
<dav.vire+haskell at gmail.com> wrote:
> 2011/5/6 Ertugrul Soeylemez <es at ertes.de>:
>> David Mazieres <dm-list-haskell-cafe at scs.stanford.edu> wrote:
>>> Please enjoy.  I'd love to hear feedback.
>> Thanks a lot, David.  This looks like really good work.  I'm using the
>> 'enumerator' package, and looking at the types your library seems to use
>> a similar, but more complicated representation.  Is there any particular
>> reason, why you didn't base your library on an existing iteratee package
>> like 'enumerator'?
> David has documented some design decisions in
> http://hackage.haskell.org/packages/archive/iterIO/0.1/doc/html/Data-IterIO.html#g:3
> Perhaps you may find some answers there.

He says that enumerator's Iteratee doesn't have special support for
pure Iteratees.  When he says that the iteratee package doesn't have
special support for control messages, the same applies for enumerator
as well.  He also says that enumerator can't distinguish failures from
iteratees and enumeratees.

He also says that the enumerator package's Enumerators aren't
iteratees, only iterIO's enumerators are.  Well, that's not what I'm

  -- from enumerator package
  newtype Iteratee a m b = Iteratee {runIteratee :: m (Step a m b)}
  type Enumerator a m b = Step a m b -> Iteratee a m b
  type Enumeratee ao ai m b = Step ai m b -> Iteratee ao m (Step ai m b)

  -- from iterIO package
  newtype Iter t m a = Iter {runIter :: Chunk t -> IterR t m a}
  type Inum tIn tOut m a = Iter tOut m a -> Iter tIn m (IterR tOut m a)
  type Onum t m a = Inum () t m a

The enumerator package's Enumerator *is* an iteratee, an so is its
Enumeratee.  The only real difference is that iterIO represents
enumerators as enumeratees from () to something.  In enumerator
package terms, that would be

  -- enumerator packages's enumerator if it was iterIO's :)
  -- note that Inum's "tIn" and "tOut" are reversed w.r.t Enumeratee
"ao" and "ai"
  type Enumerator a m b = Enumeratee () a m b

Whether this representation is better or worse isn't clear for me.

Now, one big problem that iterIO has that enumerator hasn't, is that
iterIO is a *big* library with many dependencies, including OpenSSL.
IMHO, that package should be split into many others.

So, in the enumerator vs. iterIO challenge, the only big differences I see are:

 a) iterIO has a different exception handling mechanism.
 b) iterIO can have pure iteratees that don't touch the monad.
 c) iterIO's iteratees can send control messages to ther enumerators.
 d) iterIO's enumerators are enumeratees, but enumerator's enumerators
are simpler.
 e) enumerator has fewer dependencies.
 f) enumerator uses conventional nomenclature.
 g) enumerator is Haskell 98, while iterIO needs many extensions (e.g.
MPTC and functional dependencies).

Anything that I missed?

The bottomline: the biggest advantage I see right now in favor of
iterIO is c), although it still has the problem that you may get
runtime errors if you send the wrong control message.  However, right
now e) and g) may stop many users of enumerator from porting to
iterIO, even if they like its approach.

Cheers! =)


More information about the Haskell-Cafe mailing list