[Haskell-cafe] Either as a Monad instance

Thomas Conway drtomc at gmail.com
Mon Oct 2 20:44:49 EDT 2006

Hi All,

I've been [trying to] grapple with the various monads and
transformers, and it occurs to me that the standard instance for
Either as a monadic type is unnecessarily restrictive. Is there a
compelling reason that it is not just

instance Monad (Either e) where
    return = Right
    (Left e) >>= f = Left e
    (Right x) >>= f = f x

abort = Left


More information about the Haskell-Cafe mailing list