Am Sonntag 17 Januar 2010 11:05:47 schrieb Andrew Coppin: > Is there a specific reason why GHC consistently refuses to accept the > following perfectly reasonable code snippet?
Yes, you violated the layout rule. > > main = do > putStrLn "Line 1" > putStrLn "Line 2" > > let xs = do > x <- [1..10] > y <- [1..10] > return (x+y) > > print xs > > No matter which way I rearrange this, it *insists* that there's a parse > error. This is very frustrating, given that it's utterly clear what I > want... It's not. ACLayout.hs:7:11: Empty 'do' construct should give a hint (line 7 is " let xs = do"). The next line after that is indented less than the "xs", so it ends the binding for xs (in fact, the entire let binding group) . You have to indent the lines in the do-block defining xs more than xs itself. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
