n+k patterns

Mark P Jones mpj@cse.ogi.edu
Tue, 29 Jan 2002 09:05:04 -0800


| 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.

Hugs "demands Integral" because that's what it was told to do to
follow the report.  So in that sense, yes, the code depends on
having only one class.  But it would be easy for someone to change
that.

Then again, if we're following the rules of minimal change for
Haskell 98, then I wouldn't have thought this was up for grabs.
(I'm thinking, for example, of the unnecessary "same context"
restriction on mutually recursive binding groups, which has more
practical impact, is very clearly a "bug", and has not (AFAIK)
been fixed in Haskell 98.  Then there's David Wakeling's
generalized gap proposal, and ...)

All the best,
Mark