[Haskell-cafe] Either e Monad
dk at ropas.snu.ac.kr
Tue Sep 19 03:40:58 EDT 2006
Albert Lai wrote:
> Deokhwan Kim <dk at ropas.snu.ac.kr> writes:
>> Where is the Monad instance declaration of Either e?
> It is in Control.Monad.Error as well. Strange: the doc doesn't state it.
Thanks a lot, Albert! I found the declaration in
libraries/mtl/Control/Monad/Error.hs of the ghc source distribution:
instance (Error e) => Monad (Either e) where
return = Right
Left l >>= _ = Left l
Right r >>= k = k r
fail msg = Left (strMsg msg)
More information about the Haskell-Cafe