do-and-if-then-else modification

Malcolm Wallace Malcolm.Wallace at
Mon Feb 19 07:10:29 EST 2007

Ross Paterson <ross at> wrote:

> The semicolon before the "else" is the most useful.  Adding another
> before the "then" has less motivation.

   do if foo
      then bar
      else baz

seems just as likely to occur as

   do if foo then bar
      else baz

particularly if the condition "foo" is large, and/or indentation is
already running a long distance to the right.

> > However, I have never come across the case-of expression variation
> > in practice.  Indeed, the wiki page is not very clear on what
> > exactly the problem is.
> The argument regarding "case" is that if you add a semicolon before
> "then", it would be consistent to also add one before "of".

If the only argument is consistency, then surely the same applies to the
"in" in a let expression.  But of course this would correct a problem
that never occurs in practice, because in a do-block one uses plain let,
not let-in.  So what evidence is there that case-of is a problem in


More information about the Haskell-prime mailing list