Indentation of If-Then-Else

Neil Mitchell ndmitchell at
Sun Oct 22 10:04:52 EDT 2006


> In order to solve the trouble I propose enhancements
> to teachers, compilers and standard libraries:
> 1. 'if' syntax should be teached as
>      if a
>        then b
>        else c

I love being able to ident if however I like:

if a then b else

Where b is a trivial case, and c is the hard one.

if a then

Exactly like C. Clearly delimiting the b and teh c, by putting space
between them.

if a then b else c

Short one

if a
  then b
  else c

I also occasionally use this.

It seems better to change the language so it works like _everyone_
expects it does, rather than become syntax dictators. It's hard enough
persuading people to move from C, but when you tell someone that their
perfectly unambiguous sytnax is "wrong", they aren't going to be



More information about the Haskell-prime mailing list