On Nov 22, 2007 8:19 AM, Peter Verswyvelen <[EMAIL PROTECTED]> wrote: > worksFine = > if True > then putStrLn "True" > else putStrLn "False"
This is just an expression, the indentation is inconsequential. > worksNOT = do > if True > then putStrLn "True" > else putStrLn "False" The first line, "if True", sets the indentation level of the statements in the "do" to two spaces. So this is interpreted as worksNOT = do { if True ; then putStrLn "True" ; else putStrLn "False" } Which is of course illegal. > worksAgain = do > if True > then putStrLn "True" > else putStrLn "False" Here, the indentation level of the "do" is still two spaces, but then then and else are at a higher indent than that, so they are interpreted as part of the preceding expression. The rules are actually very simple. Luke _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe