
Am Samstag, den 07.07.2012, 00:08 -0400 schrieb Tyson Whitehead:
I've thought some more about this and it seems to me that there are two ways people might intuitively think about doing grouping via indentation.
1 - the first item is on the same line and subsequent ones are lined up with it
do stmt1 stmt2
2 - the first item is on a new line and subsequent ones are lined up with it.
do stmt1 stmt2
The current layout engine is targeted at (1). It appears to do (2), but it is not really reliable as things start to go south if the first line happened to open more than one grouping (precisely the problem that make '\' a group token would introduce in codes). For an example, consider
let greet name = do putStr "hello " putStrLn name in f "world"
It currently translates into
let { greet name = do {} } putStr "hello " putStrLn name in f "world"
This results in an unituituve "Empty 'do' construct" error message.
The problem is that your example is not consistently using (2). A pure (2)-example would look like this: let greet name = do putStr "hello " putStrLn name in greet "world" And this works. :-) Best wishes, Wolfgang