Real World Haskell ch4 pp71-72
>> do x <- foo
>> y <- bar
>>
>> the y <- bar must be directly under the x on the previous line or it's a
>> syntax error, and the error you get from GHC is "the last statement of a do
>> construct must be an expression"
>
> Huh, so this Haskell syntax actually prevents you from indenting something that would be indented in any other language. Okay...
I didn't read it like this. The x and y must be lined up because they are both part of the same set of do-statements. If the y line was a standalone statement, then it could be indented as shown in this code segment. But in that case there's no need for a do, since the point of do is to order statements in sequential time.
the following is a complete Haskell program, using do, which passes through its input file to an output file. The > specifies code lines, other lines are considered comments. (I hope gmail preserves the spacing.)