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

Yitzchak Gale gale at sefer.org
Thu Jun 10 17:36:29 EDT 2010

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:


Or use the Maybe monad written additively, i.e. mplus
in place of >> (more or less).


More information about the Haskell-Cafe mailing list