Simon Peyton-Jones
Thu, 28 Mar 2002 07:28:46 -0800

James White has noticed that the draft Haskell 98 report
gives the following translation for do-notation:

        do {e}        =3D e
        do {e;stmts}  =3D e >> do {stmts}=20
        do {p <- e; stmts}  =3D let ok p =3D do {stmts}
                                  ok _ =3D fail "..."
                              in e >>=3D ok =20

On the face of it, that makes do-notation depend on the definitions of
both (>>) and (>>=3D) 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 >>=3D \_ -> 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}  =3D e >>=3D (\ _ -> do {stmts})

and that is what I *propose* to do.  =20

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