On Tue, Jul 7, 2015 at 8:04 AM, Imants Cekusins <imantc@gmail.com> wrote:
This "case" behaviour (patterns allow no access to outer scope
variables) is different from some other languages.
In most functional languages, "case" is about structure, not values. You specify the structure in terms of constructors, which must be literal. Variables in patterns always capture values associated with those constructors, never to values outside the case expression.
That said, doing a value-based comparison ("switch"-type construct) is rather annoying, and most of Haskell's (and ghc extension) mechanisms only reduce the pain somewhat. :/