[Haskell-cafe] instance Enum Double considered notentirelygreat?

Ketil Malde ketil at malde.org
Tue Sep 27 19:34:22 CEST 2011


Iavor Diatchki <iavor.diatchki at gmail.com> writes:

>>> last ([0.1, 0.2 .. 0.5]) == 0.5
>> False

>>> last (map fromRational [0.1, 0.2 .. 0.5]) == 0.5
>> True

> As Ross pointed out in a previous e-mail the instance for Rationals is
> also broken:

>> last (map fromRational [1,3 .. 20])
>> 21.0

But only because it tries to mimic the behavior of Float/Double, I
think.  Rational could easily have produced 19 here.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list