n+k patterns
Malcolm Wallace
Malcolm.Wallace@cs.york.ac.uk
Wed, 30 Jan 2002 13:44:53 +0000
> I argued that (Num a, Ord a) makes most sense to me.
> You argued that (Integral a) was a conscious choice (something I
> don't remember but I'm sure you're right), and is the right one anyway.
>
> I'd be interested to know what others think. If there's any doubt,
> we'll stay with Integral.
My view is that (n+k) patterns are evil, so it doesn't really matter
what we decide. :-) No, seriously, I'm a little worried about
widening the range of numeric types for which (n+k) patterns are
supposed to work. I can (just about) imagine wanting to use Rationals
in an (n+k) pattern, but Float and Double? I'm not convinced that
would be useful.
f :: Double -> Double
f (n+1) = n
Main> print (f 3.0)
2.0
Main> print (f 2.0001)
1.0001000000000002
Main> print (f 1.0000000001)
1.000000082740371e-10
Regards,
Malcolm