#4159: move Monad and MonadFix instances for Either from mtl to base

Tyson Whitehead twhitehead at gmail.com
Wed Jun 30 10:25:43 EDT 2010


On June 29, 2010 18:32:51 Edward Kmett wrote:
> 'Either' takes on the connotation of being the 'sum type' for the category
> of Haskell types. This sum type has a very well formed and simple monad,
> that has a lot of useful theoretical properties, and is useful in a
> strictly larger array of scenarios than the monad with the error
> constraint, with the one notable exception that it doesn't handle the
> 'fail' property that was bolted into Monad in Haskell 98.

On the topic of 'fail' being an abomination, is there any hope of fixing this?

Perhaps it could be pushed it into it's own type class, which would then 
required by the do notation?  Exactly like mdo required MonadFix.  I 
understand there was one called MonadZero for this at some time?

I could see one route would be to add a compiler flag that would switch the do 
notation requirement from Monad to MonadZero.  Instances could then be added 
to code until at some point it could become the default.  A bit longer after 
that, it could be dropped altogether along with fail in the Monad class.

Cheers!  -Tyson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://www.haskell.org/pipermail/libraries/attachments/20100630/39fbd585/attachment.bin


More information about the Libraries mailing list