
On Friday 28 May 2010 20:44:20, Donn Cave wrote:
Quoth Vo Minh Thu
, ... Control.Monad.Error provides an instance for Either.
... in the mtl transformer library, in case anyone else besides myself didn't know that. And I see it has to be there because it depends on the Error typeclass.
Which is considered a wart by some. (Either left) has a perfectly valid Monad instance for any type left (the only slightly difficult thing might be 'fail').
(So the documentation for Control.Monad.Error, is mistaken, where at the top it says
Example type: Either String a
... which should be
Either Error a
... ?
No, String is an instance of Error, so (Either String) is fine.
Though I can't really be sure what the documentation is trying to say.)
In that case, have a look at the code, perhaps that is clearer. (And bug the maintainer(s) to improve the docs.)
Donn Cave, donn@avvanta.com