[Haskell-cafe] if-then without -else?
Anthony Clayden
anthony_clayden at clear.net.nz
Tue Jul 10 00:14:37 UTC 2018
>* Why require that each "if-then" has an "else"*
Never mind the semantics, this is a piece of syntactic history.
ALGOL 60 allowed omitted "else". That gave ambiguity:
if p
then if q
then ...
...
else ...
There was no layout rule. Does the "else" match to the outer "if-then"
or the inner?
BCPL ~1965 had two constructs
if p
then test q
then ...
...
else ...
"if-then" has no "else". If you want an "else" use "test-then-else".
AntC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180710/7d39d2e9/attachment.html>
More information about the Haskell-Cafe
mailing list