Indentation of If-Then-Else
Henning Thielemann
haskell at henning-thielemann.de
Sun Oct 22 09:48:04 EDT 2006
I object strongly to the proposal
http://hackage.haskell.org/trac/haskell-prime/wiki/DoAndIfThenElse
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
http://www.haskell.org/pipermail/haskell-cafe/2006-July/016914.html
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