n+k patterns

Lennart Augustsson lennart@augustsson.net
Tue, 29 Jan 2002 20:49:52 +0100


Well, it was a deliberate decision to limit the n+k pattern to class Integral
because people at that time felt that n+k was something that should
only be used with integers.  So it's not a fluke, it was quite deliberate.
I kind of like Integral for this (as much as I can like anything about n+k :).
Since this is not a typo, I don't see why it should be changed unless there
is some really good reason.

    -- Lennart


Simon Peyton-Jones wrote:

> Folks
>
> The Haskell Report says of n+k patterns:
>
> "A n+k pattern can only be matched against a value in
> the class Integral."
>
> This seems far too strong.   All that is needed are Ord (for the >= and
> -)
> and Num (for fromInteger), and indeed that's what GHC requires.
> Do Hugs or nhc actually require Integral?
>
> In any case,  I propose to change "Integral" to "Ord and Num".
>
> Does anyone think this is the Wrong Thing?
>
> How this bug has lasted so long I don't know.
>
> Simon
>
> _______________________________________________
> Haskell mailing list
> Haskell@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell