[Haskell-cafe] Either instance of Monad?
Daniel Fischer
daniel.is.fischer at googlemail.com
Wed Feb 23 13:53:02 CET 2011
On Wednesday 23 February 2011 09:58:56, Yves Parès wrote:
> I am using mtl-2. Importing Control.Monad.Error doesn't work, I have
> to explicitly import Control.Monad.Instances.
Weird. Control.Monad.Error imports Control.Monad.Instances (), so it ought
to be visible.
What exact versions of mtl, base, GHC are you using?
>
> 2011/2/22 Daniel Fischer <daniel.is.fischer at googlemail.com>:
> > On Tuesday 22 February 2011 23:07:05, Yves Parès wrote:
> >> Hello,
> >>
> >> When importing Control.Monad.Error, it shows me that (Either e) is an
> >> instance of MonadFix, but not an instance of Monad.
> >> Isn't there a problem?
> >
> > Prelude Control.Monad.Error> :i Either
> > data Either a b = Left a | Right b -- Defined in Data.Either
> > instance (Eq a, Eq b) => Eq (Either a b) -- Defined in Data.Either
> > instance Monad (Either e) -- Defined in Control.Monad.Instances
> > instance Functor (Either a) -- Defined in Control.Monad.Instances
> > <snip>
> > instance MonadFix (Either e) -- Defined in Control.Monad.Fix
> > <snip>
> >
> > Works right here. With mtl-1.*, there's an (Error e) restriction on
> > the instances.
More information about the Haskell-Cafe
mailing list