[Haskell-cafe] Re: Why does Haskell have the if-then-else syntax?

ajb at spamcop.net ajb at spamcop.net
Wed Aug 16 19:48:44 EDT 2006

G'day all.

Quoting Benjamin Franksen <benjamin.franksen at bessy.de>:

> For what it's worth, I have been asking myself the same question several
> times. If/then/else syntax could be replaced by a regular (lazy) function
> without any noticeable loss.

I believe that if-then-else cannot be replaced by a regular function
for the same reason that regular function application and ($) are not
identical.  The loss may not be noticeable, but it's still a loss.

It could be replaced by a case-switch-on-Bool, though.

> IMHO, the next standardized version of Haskell, however named, should
> abandon the special if/then/else syntax so we'll have at least /one/ item
> where the language becomes smaller and simpler.

The de facto Haskell philosophy, if you read the history paper, is to
have a small core language with a lot of syntactic sugar.  The syntactic
sugar is specified by translation to the core language.

The small core ensures that Haskell remains simple.  If you discount
changes in the type system, the Haskell core language is as simple now
as it was in 1989.

> Remember: Perfection is reached not when there is nothing more to add, but
> rather when there is nothing more to take away.

Perfection is asymptotically approached when arbitrary restrictions are
removed and special cases are dumped in favour of general, theoretically
sound, principles.  Perfection will never be reached in a practical
programming language, but it may be asymptotically approached.

Andrew Bromage

More information about the Haskell-Cafe mailing list