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

Benjamin Franksen benjamin.franksen at bessy.de
Tue Aug 15 18:57:17 EDT 2006


Mike Gunter wrote:
>I had hoped the "History of Haskell" paper would answer a question
>I've pondered for some time: why does Haskell have the if-then-else
>syntax?  The paper doesn't address this.  What's the story?

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. Almost every time I use if/then/else I end up
changing it to a case expression on teh underlying data (which is almost
never Bool); the only exception being simple one liners, and for those a
function would be even more concise.

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.

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

On another note, I remember reading a paper proposing to generalize
if/then/else to arbitrary (so-called) dist-fix operators, using something
like partial backquoting, as in

`if condition `then` true_branch `else` false_branch fi`

Can't remember the exact title of the paper, nor the details, but it was
something to do with adding macros to Haskell.

Cheers,
Ben



More information about the Haskell-Cafe mailing list