James White has noticed that the draft Haskell 98 report
gives the following translation for do-notation:
do {e} = e
do {e;stmts} = e >> do {stmts}
do {p <- e; stmts} = let ok p = do {stmts}
ok _ = fail "..."
in e >>= ok
On the face of it, that makes do-notation depend on the definitions of
both (>>) and (>>=) in the monad. This makes a difference if someone
defines an instance of the Monad class in which (>>) is not defined to
be (\x y -> x >>= \_ -> y).
I am certain that was not the intention of the authors. So one
possibility is to change the second line to read
do {e;stmts} = e >>= (\ _ -> do {stmts})
and that is what I *propose* to do.
However, James implies that in his monad (>>) has a different meaning
than its usual one, and Haskell 98 allows that because (>>) is one of
the class operations (not a good design choice I think). I'm quite
reluctant to make the meaning of do-notation dependent on such
differences. James, can you convince us that doing so would be a good
idea?
Simon
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell