[Haskell-cafe] Using the ContT monads for early exits of IO ?

Jason Dagit dagit at codersbase.com
Fri Jun 11 00:10:40 EDT 2010


On Thu, Jun 10, 2010 at 8:45 PM, Derek Elkins <derek.a.elkins at gmail.com>wrote:

> Or... one could just use the exceptions that are already built into
> the IO monad...
>

It feels to me like this discussion has a lot of speculation in it.  I would
like to see concrete examples of the code and the suggested improvements.


> 2010/6/10 Yitzchak Gale <gale at sefer.org>:
> > Lennart Augustsson wrote:
> >> I would not use the continuation monad just for early exit.  Sounds
> >> like the error monad to me.
> >
> > I.e., the Either/ErrorT monad. But the mtl/transformers packages
> > have an orphan instance for Either that requires the
> > exit type to be an instance of the Error class. If that
> > doesn't work in your case, use the Exit monad:
> >
> > http://www.haskell.org/haskellwiki/New_monads/MonadExit
> >
> > Or use the Maybe monad written additively, i.e. mplus
> > in place of >> (more or less).
> >
> > Regards,
> > Yitz
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100610/c29c703a/attachment.html


More information about the Haskell-Cafe mailing list