Brian Boutel wrote:

>n+k patterns make sense for a type of Natural Numbers (including 0),
>but not for general Integral types.
>
>They are also dangerous because they are defined in terms of < and -,
which,
>in a user-defined type, need not obey the usual laws, e.g. you cannot
assume
>that 0 < 1 holds.
>
>The problem is that dropping them would break lots of stuff - but probably
>more textbooks than programs.

I wonder. It probably depends on how much mindshare (n+k) patterns have.
Personally, I have never used one, but since I'm disinclined to do so I may
not have noticed situations in which they come in handy -- if indeed there
are such things.

I imagine it would be possible to write a Haskell program to translate
functions using (n+k) patterns to other forms. Distributing such a program
along with the new (n+k)-less compiler would make for an easy transition for
those who have made significant use of such patterns.

Craig



Reply via email to