cvs commit: hugs98/libraries/Hugs Prelude.hs
Ross Paterson
ross@soi.city.ac.uk
Wed, 23 Oct 2002 14:26:55 +0100
On Tue, Oct 22, 2002 at 04:04:26AM -0700, nordin@glass.cse.ogi.edu wrote:
> nordin 2002/10/22 04:04:25 PDT
>
> Modified files:
> libraries/Hugs Prelude.hs
> Log:
> Add explicit enumFromTo and enumFromThenTo for Ratio. From Ferenc Wagner.
Maybe it would be better to copy this out of the derived Report, except
maybe for the additional strictness. But anyway its usefulness is
limited until Hugs implements floating point literals in the H98 way.
For example, consider the following expression (from the test suite):
[-10.0,-9.9..10.0 :: Ratio Int]
In Haskell 98, this is the same as
[-10%1,-99%10..10%1 :: Ratio Int]
but in Hugs we get
[-10 % 1,-5190451 % 524288
Program error: Ratio.%: zero denominator
because (-5190451 % 524288) + (52429 % 524288::Ratio Int) overflows.
(With Integer it doesn't, but the fractions are silly.)