[Haskell-cafe] instance Enum Double considered notentirelygreat?
cdsmith at gmail.com
Tue Sep 27 20:54:51 CEST 2011
On Tue, 2011-09-27 at 09:47 -0700, Iavor Diatchki wrote:
> As Ross pointed out in a previous e-mail the instance for Rationals is
> also broken:
> > last (map fromRational [1,3 .. 20])
> > 21.0
Sure, for Int, Rational, Integer, etc., frankly I'd be in favor of a
runtime error when the last value isn't in the list. You don't need
approximate behavior for those types, and if you really mean
takeWhile (<= 20) [1,3..], then you should probably write that, rather
than a list range notation that doesn't mean the same thing.
More information about the Haskell-Cafe