
17 Jul
2003
17 Jul
'03
2:50 p.m.
I've thought for a while that it would be nice to have a shorthand for `if` / `else if` chains. For example: if a < b then "less" else if a == b then "equal" else "greater" can be rendered with more structure as: case () of _ | a < b -> "less" | a == b -> "equal" | otherwise -> "greater" but would look even nicer as: case | a < b -> "less" | a == b -> "equal" | otherwise -> "greater" The shorthand just above requires a single addition to the Haskell grammar: exp10 -> `case` gdpat with trivial translation to: `case` () `of` { _ gdpat } -- Dean