[Haskell-cafe] Re: ANNOUNCE: enumerator, an alternative iteratee package

John Lato jwlato at gmail.com
Tue Aug 24 08:12:55 EDT 2010


>
> From: Magnus Therning <magnus at therning.org>
>
> On 24/08/10 03:47, John Millikin wrote:
> [...]
> > I would like to avoid hard-coding the error type to SomeException,
> because
> > it forces libraries to use unsafe/unportable language features (dynamic
> > typing and casting). However, given the apparent practical requirement
> that
> > all iteratees have the same error type, it seems like there's no other
> > choice.
>
> I haven't worked enough with iteratees to have an informed opinion on this,
> but I wonder what the pros and cons are of having an error state in the
> iteratees at all.  In other words, why would this
>
>  data Step a m b
>      = Continue (Stream a -> Iteratee a m b)
>      | Yield b (Stream a)
>      | Error E.SomeException
>
> be preferred over this
>
>  data Step a m b
>      = Continue (Stream a -> Iteratee a m b)
>      | Yield b (Stream a)
>
> (Maybe with the restriction that m is a MonadError.)
>

Oleg included the error state to enable short-circuiting of computation, and
I guess everyone just left it in.  Recently I've been wondering if it should
be removed, though, in favor requiring explicit (i.e. explicit in the type
sig) exceptions for everything.  I'm not sure if that would be more or less
complicated.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100824/4f3023ea/attachment.html


More information about the Haskell-Cafe mailing list