
6 May
2009
6 May
'09
5:36 p.m.
Hi, Martijn van Steenbergen wrote:
Mr. McBride and mr. Paterson define in their Applicative paper:
data Except e a = OK a | Failed e instance Monoid e => Applicative (Except e) where ...
Sometimes I'd still like to use >>= on Excepts but this "feels" wrong somehow, because it doesn't use monoids nicely like the Applicative instance does. Are there any good reasons such a Monad instance shouldn't be defined? Does it violate any laws, for example?
The problem is that one would like to define Failed e1 >> Failed e2 = Failed (e1 `mappend` e2) but then p >> q is no longer the same as p >>= const q which could be confusing. Tillmann