Removal candidates in patterns
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Thu Jan 26 13:37:13 EST 2006
On Thu, 2006-01-26 at 17:31 +0000, Simon Peyton-Jones wrote:
> I agree that if (n+k) patterns go, then so should k patterns. Both are
> overloaded, and that's the root of their complexity.
I have to say that we use 'k' patterns in teaching all the time, though
we do not teach n+k patterns. There are lots of cases where it's
convenient to say:
foo 0 = ...
foo n = ...
Intuitively it seems reasonable to me that 1 is a constructor for the
Int type just as 'c' is a constructor for type Char, and since it's a
constructor we can pattern patch on it.
To be honest, the difficulty of the internal translation needed for
tools seems less important to me than the convenience for users. I don't
think the difference that character constants are not overloaded where
as numeric constants are overloaded causes any difficult in
understanding for users.
Duncan
More information about the Haskell-prime
mailing list