I was under the impression that there was an instance for Either a somewhere, but I can\'t seem to find it. I have tried importing Control.Monad, Control.Monad.Instances and
As of base 4.6, the instance is in Data.Either
itself.
This instance has been added in base 4.3.x.x
, which comes with ghc 7
. Meanwhile, you can use the Either
instance directly, or, if you are using Either
to represent something
that may fail you should use ErrorT monad transformer.
There is not an instance for Either a
, but there is for Either String
in Control.Monad.Error
. (Actually, it's for Error e => Either e
, IIRC).
I believe there's something in Control.Monad.Error
- don't have anything to check, though.