Re: [Haskell-cafe] Either as a Monad instance

2006-10-03 Thread Lennart Augustsson
On Oct 3, 2006, at 03:49 , Ross Paterson wrote: On Tue, Oct 03, 2006 at 10:44:49AM +1000, Thomas Conway wrote: I've been [trying to] grapple with the various monads and transformers, and it occurs to me that the standard instance for Either as a monadic type is unnecessarily restrictive. Is

Re: [Haskell-cafe] Either as a Monad instance

2006-10-03 Thread Ross Paterson
On Tue, Oct 03, 2006 at 07:52:54AM -0400, Lennart Augustsson wrote: Yes, having fail in the Monad is a horrible wart. And like some other warts in Haskell it was added to cure the symptom rather than the disease. :( Switching metaphors, what do you see as the disease in this case? (As far as

Re: [Haskell-cafe] Either as a Monad instance

2006-10-03 Thread Brian Hulley
Ross Paterson wrote: On Tue, Oct 03, 2006 at 07:52:54AM -0400, Lennart Augustsson wrote: Yes, having fail in the Monad is a horrible wart. (As far as I know, it's there for the translation of pattern match failure in do-expressions.) I think it would be much less of a wart if the signature

Re: [Haskell-cafe] Either as a Monad instance

2006-10-03 Thread Lennart Augustsson
It all came about because pattern matching failure sometimes cause a do expression to be in MonadZero rather than Monad with the old translation. This gave rise to confusing error messages, it was claimed. This was the disease. -- Lennart On Oct 3, 2006, at 08:28 , Ross Paterson

[Haskell-cafe] Either as a Monad instance

2006-10-02 Thread Thomas Conway
Hi All, I've been [trying to] grapple with the various monads and transformers, and it occurs to me that the standard instance for Either as a monadic type is unnecessarily restrictive. Is there a compelling reason that it is not just instance Monad (Either e) where return = Right (Left