
On Tue, May 25, 2010 at 07:08:26PM +0200, Bas van Dijk wrote:
I assume that when this instance is added to Control.Applicative, the one in Control.Monad.Trans.Error from transformers will be removed.
Yes. It may need some ifdeffery.
On Tue, May 25, 2010 at 6:22 PM, Yitzchak Gale
wrote: -1 for the orphan Monad instance with the silly superclass constraint that this Applicative instance is meant to extend
I assume you are referring to:
instance (Error e) => Monad (Either e) where return = Right Left l >>= _ = Left l Right r >>= k = k r fail msg = Left (strMsg msg)
defined in Control.Monad.Trans.Error from transformers or Control.Monad.Error from mtl.
Thinking out loudly: since the 'fail' method is considered to be a mistake, what about not defining it? As in:
instance Monad (Either e) where return = Right Left l >>= _ = Left l Right r >>= k = k r
Fine by me. Making it a non-orphan would break Haskell 98 compatibility, though. You'd also have to delete its MonadPlus instance.