Folks

The concrete is setting fast, but Ross points out that the instance for
Enum (Ratio a) is inconsistent with that for Enum Float and Enum Double.
(It's strange that these non-integral types are in Enum, but we're stuck
with that.)

All three use 'numericEnumFrom' etc for the enumFrom method, but Float
and Double define succ and pred thus:

        instance Enum Float where
                succ x = x+1
                pred x = x-1

But Ratio does not... it uses the default method for succ/pred which
gives

        instance Integral a => Enum (Ratio a) where
                succ x = fromInt (1 + (toInt x))

Thus (succ (1.5 :: Float)) is 2.5
but   (succ (3%2)) is 2%1

Furthermore, you'd expect that 
        [x..y]
would mean the same as
        [x,succ x .. y]
and that is true for Float/Double but not for Ratio.

So I propose to modify the instance decl for Ratio by adding explicit
defns for succ/pred just like those in Float/Double.  

Any objections?

Simon


PS: CUP are typesetting the report now, assuming we can come to happy
agreement about copyright etc.  On that front, the CUP wheels are
grinding, but they grind slow.  I'll emit an update when I know
something useful.
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to