[Haskell-cafe] Guide for converting existing code to Conduit 0.4?

Michael Snoyman michael at snoyman.com
Mon Apr 9 13:46:59 CEST 2012


On Mon, Apr 9, 2012 at 2:37 PM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> On 9 April 2012 21:34, Michael Snoyman <michael at snoyman.com> wrote:
>>
>> It's caused by fmap. This is one of the downsides with the move to a
>> single type:
>
> I've been reading the various posts you've been making about Conduit,
> and this is something I still don't get: wasn't one of the original
> strengths you touted for Conduit that usage of different types made
> for better error messages, etc.?  As such, why have you now switched
> to a single type and thus causing these kinds of problems again?

Honestly, I'm still torn on this. If you read through the arguments in
Reddit, you'll see a lot of:

  Everyone else: Well, obviously this is more elegant because it's a single type
  Me: Err.... I'm not convinced.

There *are* definitely advantages to this new approach, but there are
also costs. The fact that such a huge part of the codebase simply
disappeared, and that it's easier to step through the remaining code
and convince myself that it's doing the right thing, is what put me
over the edge on this one.

To clarify just a bit: the *main* advantage of conduit's multiple
types approach (versus enumerator where everything is an Iteratee) is
that (1) it's easier to understand, and (2) it makes it possible to do
things like resumable sources. Both of those advantages still hold:
writing a Conduit retains its relative simplicity versus an Enumeratee
in this new system, for example. The downside is really the error
messages and the instances.

It might be that we decide to introduces newtype wrappers for Source,
Conduit, and Sink in the future to solve these problems, I'm not sure.
For now, it seems like an acceptable trade-off.

Michael



More information about the Haskell-Cafe mailing list