[Haskell-cafe] Portability of MonadError

Luke Palmer lrpalmer at gmail.com
Mon Jan 5 16:51:02 EST 2009

On Mon, Jan 5, 2009 at 2:13 PM, Luke Palmer <lrpalmer at gmail.com> wrote:

> Then your example can become::
> func = (mapError Left funcA >> mapError Right funcB) `catchError` (\e ->
> ...)
> Luke

Oh bother!  My new year's resolution: think before I speak.

While I do think this is the right answer, it is not the right answer in the
status quo.  This is because ErrorT e m is only a monad when e is an Error,
which Either (and most types) are not.  It will be the right answer when
fail is factored out of Monad into MonadFail (which will happen someday
hopefully), because then the typechecker will verify that the above
composition cannot fail.

But now I can't think of a good answer.  Darn.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090105/f51842b6/attachment.htm

More information about the Haskell-Cafe mailing list