I've read this question. Here is citation of accepted answer:
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 usingEither
to represent something that may fail you should useErrorT
monad transformer.
I want to use Either
for something like this:
> (Left "bad thing happened") >>= \x -> Right (x ++ " ...")
Left "bad thing happened"
So, if one part of the computation fails, its Left
is returned.
Actual question is: why should I use ErrorT
monad transformer instead of Either
monad? I'm a novice in Haskell, and I'm kinda afraid of monad transformters, especially when I'm already writing code inside one.