
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