n+k patterns
Ross Paterson
ross@soi.city.ac.uk
Tue, 29 Jan 2002 15:47:24 +0000
On Tue, Jan 29, 2002 at 07:36:56AM -0800, Simon Peyton-Jones wrote:
> 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 Num (for - and fromInteger), and indeed that's what GHC requires.
> Do Hugs or nhc actually require Integral?
Hugs demands Integral and the assumption that only one class is involved
seems deeply entwined in the code.
> In any case, I propose to change "Integral" to "Ord and Num".
Without this change, the relevant rule of the formal semantics of patterns
wouldn't preserve the static semantics.