[Haskell-cafe] ErrorT vs Either

Yves Parès limestrael at gmail.com
Mon May 16 23:05:22 CEST 2011


Probably because in the instance of Monad Either, fail has not been
overloaded, and still has its default implementation:
fail = error
Whereas runErrorT explicitely catches the exception.


2011/5/16 Gracjan Polak <gracjanpolak at gmail.com>

>
> Hi all,
>
> A why question: Why:
>
> Control.Monad.Error Prelude> runErrorT (fail "msg") :: IO (Either String
> Int)
> Left "msg"
>
> but
>
> Control.Monad.Error Prelude> (fail "msg") :: (Either String Int)
> *** Exception: msg
>
> ?
>
> --
> Gracjan
>
>
>
> _______________________________________________
> 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/20110516/cdbe9021/attachment.htm>


More information about the Haskell-Cafe mailing list