[Haskell-cafe] instance Enum Double considered notentirelygreat?
iavor.diatchki at gmail.com
Tue Sep 27 18:47:31 CEST 2011
On Tue, Sep 27, 2011 at 8:49 AM, Chris Smith <cdsmith at gmail.com> wrote:
> You could calculate the entire range using Rational and then convert
> each individual value after the fact. That doesn't seem like a
> reasonable default, since it has a runtime performance cost. Of course
> you're welcome to do it when that's what you need.
>> last ([0.1, 0.2 .. 0.5]) == 0.5
>> last (map fromRational [0.1, 0.2 .. 0.5]) == 0.5
As Ross pointed out in a previous e-mail the instance for Rationals is
> last (map fromRational [1,3 .. 20])
More information about the Haskell-Cafe