[Haskell-cafe] Conduit experiment: Is this correct?

Erik de Castro Lopo mle+hs at mega-nerd.com
Fri Feb 3 22:19:41 CET 2012

Ertugrul Söylemez wrote:

> Thanks a lot.  This conduit world is really new to me and feels a bit
> more complicated than enumerators, but at least I seem to be getting the
> right intuition.

I can assure you that while this may be true for simple cases, it most
definitely is not true for at least one more complex case.

I have a hackage package http-proxy which initially used Enumerator and
now uses Conduit. The Enumerator version was extremely difficult to figure
out and eventually required a function like this:

    enumIteratee :: MonadIO m => Int64
                 -> (Int -> Iteratee ByteString m ByteString)
                 -> Enumerator ByteString (Iteratee ByteString m) c

with an Iteratee nested inside an Enumerator.

The Conduit version was much easier to put together because conduits seem
to compose much more naturally. IMO, Conduit is a significant improvement
over Enumerator but a better solution may still exist (I'm interested in
seeing how Pipes work out).

Erik de Castro Lopo

More information about the Haskell-Cafe mailing list