[Haskell-cafe] Monadic function fails as Nothing in Maybe context but as Exception in Either context.

William Yager will.yager at gmail.com
Tue Dec 1 20:34:57 UTC 2015


Shouldn't that be "throwError", not "fail"?

--Will

On Tue, Dec 1, 2015 at 12:44 PM, Jeffrey Brown <jeffbrown.the at gmail.com>
wrote:

> I spoke too soon; I'm seeing the same problem with MonadError.
>
>     Prelude> :set -XFlexibleContexts
>     Prelude> import Control.Monad.Except
>     Prelude Control.Monad.Except> let f = (fail "be Left!" :: (MonadError
> String m) => m ())
>     Loading package transformers-0.4.2.0 ... linking ... done.
>     Loading package mtl-2.2.1 ... linking ... done.
>     Prelude Control.Monad.Except> f :: Either String ()
>     *** Exception: be Left!
>     Prelude Control.Monad.Except>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151201/99f2e99e/attachment.html>


More information about the Haskell-Cafe mailing list