On Tue, May 14, 2002 at 04:57:12PM +0200, George Russell wrote:
> According to the report
> > Instances of Monad should satisfy the following laws:
> >
> >    return a >>= k          = k
> >    m >>= return            = m
> >    m >>= (\x -> k x >>= h) = (m >>= k) >>= h
> so neither IO nor my events satisfy this.  Up to now I haven't had
> any problems with this.
 
> Does GHC or any other Haskell compiler actually rely on instances of
> Monad satisfying left identity?  If not, I would suggest dropping
> the requirement, if it can be done without upsetting category
> theorists.  (What the hell, they stole the term "Monad" from
> philosophy and changed its meaning, so why shouldn't we?)

I don't think this is necessarily wise to drop this from the report
altogether.  To me, it seems comparable to associativity of addition
for instances of Num; many instances don't satisfy it (e.g., Float),
but it's a useful guideline to keep in mind.

I've often been bothered by the inconsistent treatment of laws in the
report; why are there laws for functors, monads, and quot/rem and
div/mod, and not much else?  I'm pleased to see that the laws that are
given actually do have exceptions.

--Dylan

Attachment: msg10876/pgp00000.pgp
Description: PGP signature

Reply via email to