Re: [Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-12 Thread Henning Thielemann
Evan Laforge schrieb: On Fri, Sep 11, 2009 at 6:10 AM, Edward Kmett ekm...@gmail.com wrote: Unfortunately, the instance of Monad for Either a is somewhat misguided in Haskell. There is a spurious restraint that the Left value in your Either be a member of some Error class, which was brought

Re: [Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-12 Thread Edward Kmett
You could, but then you need overlapping instances to define the one in Control.Monad.Error. -Edward Kmett On Sat, Sep 12, 2009 at 4:26 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: Evan Laforge schrieb: On Fri, Sep 11, 2009 at 6:10 AM, Edward Kmett ekm...@gmail.com wrote:

Re: [Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-11 Thread Edward Kmett
Unfortunately, the instance of Monad for Either a is somewhat misguided in Haskell. There is a spurious restraint that the Left value in your Either be a member of some Error class, which was brought about by the deletion of MonadZero from Haskell 98 (as part of the elimination of failure free

Re: [Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-11 Thread Evan Laforge
On Fri, Sep 11, 2009 at 6:10 AM, Edward Kmett ekm...@gmail.com wrote: Unfortunately, the instance of Monad for Either a is somewhat misguided in Haskell. There is a spurious restraint that the Left value in your Either be a member of some Error class, which was brought about by the deletion

Re: [Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-11 Thread Michael Steele
Right. I know there was some argument a while back, but I thought that position that instances are global period was pretty official. At least it made sense to me. The more libraries you import the less control you have over the extent of what they may import. But I guess it wouldn't be

Re: [Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-11 Thread Evan Laforge
if I understand you correctly, all libraries that software I write depends on, directly or indirectly, must be free of namespace conflicts.  Is that correct? Well, it may be more accurate to say that class instances have no namespaces, and are all implicitly global. When you import a module,

[Haskell-cafe] instance Monad (Either String) in Prelude or Data.Either?

2009-09-10 Thread Evan Laforge
Is there any particular reason to not move the instance to the prelude? A module was failing when imported from one place and ok when imported from another, so I spent a frustrating 10 minutes searching for the instance. I couldn't find a way to search haddock for instances (not even grep on the

[Haskell-cafe] instance Monad Either?

2007-12-20 Thread Eric
According to this http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors Either is an instance of class Monad, but when I try to use the do notation I get a compiler error. What's going on? E. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] instance Monad Either?

2007-12-20 Thread Tom Phoenix
On 12/20/07, Eric [EMAIL PROTECTED] wrote: According to this http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors Either is an instance of class Monad, but when I try to use the do notation I get a compiler error. What's going on? Near the bottom of that page is a

Re: [Haskell-cafe] instance Monad Either?

2007-12-20 Thread Eric
Tom Phoenix wrote: On 12/20/07, Eric [EMAIL PROTECTED] wrote: According to this http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors Either is an instance of class Monad, but when I try to use the do notation I get a compiler error. What's going on? Near the

Re: [Haskell-cafe] instance Monad Either?

2007-12-20 Thread Tillmann Rendel
Eric wrote: According to this http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors Either is an instance of class Monad, but when I try to use the do notation I get a compiler error. What's going on? Try to import Control.Monad.Error to get a Monad instance for