On 2/15/07, Sebastian Sylvan <[EMAIL PROTECTED]> wrote:
On 2/15/07, Rob Hoelz <[EMAIL PROTECTED]> wrote:
> foo = do
> bar
> baz
> other_func
> bar = ...
>
> How does it know to stop at other_func?
The "offside rule". Bar starts on the same column as foo so it's a new
definition rather than belonging to foo.
If you don't quite trust the indentation you can use '{' and '}'
instead. When do is followed by '{' it uses ';' to separate lines
instead of newlines. This is equivalent to the above:
foo = do {
bar ; baz ;
other_func ;
}
bar = ...
Although I would rarely use this. ';' can also be used in other
places, such as separating the alternatives in a case statement. I
really like the fact that Haskell can mix and match the indentation
and brace styles - something other languages should try to pick up.
Aaron
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell