
On Sat, Jun 20, 2009 at 11:44:09AM -0400, George Huber wrote:
Maurício wrote:
Also, using layout,
do a <- x let b = a y b z
expands to
do {a <- x ; let {b = a} in do {y b >> z}}
I'm curious as to where the second `do' came from?
Well, the above translation isn't quite correct, the second 'do' wouldn't come until later. The point is that 'do { let x = y; foo }' translates to 'let x = y in do { foo }'. So do a <- x let b = a y b z gets translated as follows: do { a <- x ; let b = a ; y b ; z } (that's just inserting braces and semicolons using layout), and then x >>= \a -> do { let b = a ; y b ; z } x >>= \a -> let b = a in do { y b ; z } x >>= \a -> let b = a in yb >> do { z } x >>= \a -> let b = a in yb >> z -Brent