[Haskell-cafe] ";" in do

Larry Evans cppljevans at suddenlink.net
Thu Dec 30 14:04:11 CET 2010

On 12/29/10 22:40, Daryoush Mehrtash wrote:
> Why do people  put  ";" in do {}, or "," in data fields,  at the 
> beginning of the line? 
> -- 
It reflects the parse tree better by putting the
combining operators (e.g. ';' and ',') at the left
and their operands (or combined subtrees) indented
to the right.  IOW, this formating style rotates
the parse tree:

     /  \
    /    \
   s1    s2

for operator o_ and subtrees, s1 and s2,
-90 degrees and replaces the connecting edges with

    o_ s2

now, it surrounds that with the begin(b_) and end(e_)

    b_ s1
    o_ s2

For example, in the case of a tuple with arguments,
a1 and a2, this would appear:

    ( a1
    , a2

This also improves readability in a similar way that
bulleted list items in a text document improve readability.
For example:

    * s1
    * s2

is easier to read than:


because the reader knows that * begins an item and he
only has to search a given column for the beginning
of the next item.

However, some people object to this style because
it requires too much vertical space as compared

    ( a1, a2 )



More information about the Haskell-Cafe mailing list