[Haskell-cafe] instance Enum Double considerednotentirelygreat?
Chris Smith
cdsmith at gmail.com
Tue Sep 27 20:12:57 CEST 2011
On Tue, 2011-09-27 at 09:23 -0700, Donn Cave wrote:
> I think it's more than reasonable to expect
>
> [0.1,0.2..0.5] == [0.1,0.2,0.3,0.4,0.5]
>
> and that would make everyone happy, wouldn't it?
But what's the justification for that? It *only* makes sense because
you used short decimal literals. If the example were:
let a = someComplicatedCalculation
b = otherComplicatedCalculation
c = thirdComplicatedCalculation
in [a, b .. c]
then it would be far less reasonable to expect the notation to fudge the
numbers in favor of obtaining short decimal representations, which is
essentially what you're asking for.
--
Chris
More information about the Haskell-Cafe
mailing list