Indentation of If-Then-Else

Henning Thielemann haskell at
Sun Oct 22 09:48:04 EDT 2006

I object strongly to the proposal
because it solves problems with syntactic sugar with even more sugar,
where no sugar is needed at all.

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
   This indentation makes pretty clear,
   what is condition, and what is the result in both cases.
   It just resembles
     case a of
       True  -> b
       False -> c  .
2. Add 'if :: Bool -> a -> a -> a'
   or  '(?) :: Bool -> (a,a) -> a'
   or both to the standard library, as discussed in the thread starting with
3. If a compiler suspects that a parsing problem is related to 'do' and 'if'
   it should suggest indentation
     if a
       then b
       else c
   or even better, the usage of if- or (?)-function.

So, please add this to the 'Cons' list.

More information about the Haskell-prime mailing list