Case expressions, matching, and "constants"
Mark P Jones
Thu, 17 Jul 2003 09:25:19 -0700
| I've just debugged a program that used a case expression, but
| where I was trying to match on constants rather than literals.
| Here's a contrived example:
| > module Main where
| > one = 1
| > two = 2
| > test n =
| > case n of
| > one -> "one"
| > two -> "two"
| > _ -> "three"
| > main = putStrLn (test 2)
There's a 1992 tech report by Aitken and Reppy that provides a proposal
for doing this kind of thing (and a bit more) in the context of SML:
All the best,