[Haskell] How does "do" know when to stop?

Sebastian Sylvan sebastian.sylvan at gmail.com
Thu Feb 15 16:18:17 EST 2007

On 2/15/07, Rob Hoelz <hoelz at wisc.edu> wrote:
> When I define a function and I use do to string functions together, how
> does it know when my list of functions has come to an end?  For example:
> 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.

Sebastian Sylvan
UIN: 44640862

More information about the Haskell mailing list