| Both GHC and Hugs have a bug in their Prelude for Ratio's Enum
| instance. The following program
| 
|    import Ratio
|    main = print [ 1, 4%(3::Int) .. 2 ]
| 
| should print
| 
|    [1 % 1,4 % 3,5 % 3,2 % 1]
| 
| but instead an infinite list of 1%1s is generated. The reason for this
| is that the default method for enumFromThenTo is used, which truncates
| 4%3 to 1 (same for enumFromTo). 

| Malcolm Wallace wrote:
| > I'd say that this is a bug in the Library Report, which seems to
| > specify this implementation. [...]
| 
| But for Float, Double, Ratio and friends the report explicitly
| states that numericEnumFromFooBar has to be used, which generates
| the finite list. So it's only a bug in all implementations. >:-)


Indeed, GHC's libraries are wrong.  We'll fix that.

I don't propose to change the H98 defn of Enum instances though,
flawed though they may be.

Simon

Reply via email to