2010/5/28 Donn Cave <d...@avvanta.com>:
> Quoth Ivan Lazar Miljenovic <ivan.miljeno...@gmail.com>,
>
>>   Whilst the Either type isn't officially used for
>> errors, that is how it is usually treated in Haskell with the consensus
>> that Left = failure and Right = success (note that due to how its
>> defined it also has to be this way for Either's Monad instance to
>> work).
>
> I'm glad you mentioned that, I was going to mention how natural it
> would seem for Either to be an instance of Monad, given that it is
> used as you say by consensus for errors ... but something seems to
> be wrong with my libraries:
>
>    No instance for (Monad (Either [Char]))
>      arising from a use of `return' at except.hs:25:24-29
>    Possible fix:
>      add an instance declaration for (Monad (Either [Char]))
>
> So, I understand how to make a Monad instance, and I guess your
> point stands (as demonstrated by the expected type of (Either String)),
> but it's funny that Either is understood to have a Monad instance
> even though that's only implied, and not supplied.
>
> [snip]

Hi,

Control.Monad.Error provides an instance for Either.

Cheers,
Thu
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to