[Haskell-cafe] instance Monad (Either String) in Prelude or
Data.Either?
Evan Laforge
qdunkan at gmail.com
Thu Sep 10 21:03:43 EDT 2009
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 html), nor hoogle, nor anything
else. Finally I turned to google and found a couple of haskell-cafe
threads with people wondering why other people's code failed for them.
This was especially frustrating because I knew I had written my own
instance when I originally couldn't find it, then removed my own when
I did find it, then forgot where I found it *two times* so I knew it
existed, just not where. So this is the third time I've done this
search. Now I have a few commented 'import Control.Monad.Error ()'
scattered about in a few "low level" modules to try to make sure it's
visible everywhere and next time I go hunting I can look in my own
modules.
If orphan instances are discouraged, shouldn't the instance for Monad
Either be declared where Either is? This should probably go for
Functor Either too. I notice that Monad Maybe is in Prelude, and it
would be a pain if it weren't.
If there's no particular reason to not move it, I'll do a libraries
proposal... or since it involves the prelude should this be
haskell-prime?
More information about the Haskell-Cafe
mailing list