
Daniel Fischer
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').
Though how would you set the Left value for some arbitrary type?
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.)
IIRC, the basic point is that the Left type has to be one which can be converted from some arbitrary String value, to take into account the fail method for that type: fail :: (Monad m) => String -> m a -- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com IvanMiljenovic.wordpress.com