
18 Aug
2007
18 Aug
'07
11:19 a.m.
On 8/18/07, Andrew Coppin
Surely all this means is that the magical "mdo" keyword makes the compiler arbitrarily reorder the expression...?
What mdo actually does is described here: http://www.cse.ogi.edu/PacSoft/projects/rmb/mdo.pdf My last example desugars to: test = mfix ( \ ~(x,y,z,v) -> do z <- return $ x+y print "Hello" x <- readLn y <- readLn v <- return z return (x,y,z,v)) >>= \(x,y,z,v) -> return v So at core there really is a do-expression that's passing 'return $ x+y' into a print which in turn is passed into the 'readLn's. -- Dan