
Dear Cafe, a student in my class detected this inconsistency in the design of Haskell:
Why require that each "if-then" has an "else" while still allowing incomplete sets of patterns? We could define "if p then a" by translating to "case p of { True -> a }"
I think that "but then we'd have the dangling-else problem" is not a good answer because this is really about semantics, not surface syntax. For reference, Scheme has short-if, see http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_sec_11.4.3 (value is "unspecified" if condition is false) and Common LISP does as well https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node84.html#SECTION0011600000... (value is "nil") Was this considered at some point in Haskell's design process? There is Section 5.2 on pattern matching in http://haskell.cs.yale.edu/wp-content/uploads/2011/02/history.pdf (*) but it does not mention if-then(-else). - J.W. (*) can we please add this to https://www.haskell.org/documentation Upvote this: https://github.com/haskell-infra/hl/issues/86