[Haskell-cafe] instance Enum Double considered not entirely great?
Evan Laforge
qdunkan at gmail.com
Wed Sep 21 00:05:32 CEST 2011
> complete enumeration. I'm taking it for granted that the current
> behavior on Float is useful; I honestly don't see how you could argue
> with that. People use it all the time; I used it just this morning. Of
> course it's useful.
It was useful but not as useful as a 'range' function. I thought it
was quite useful and used it even though I *already knew* about 'last
[0, 0.1 .. 2] > 2'. But of course this eventually lead to a tricky
bug, followed by a "never again" and witch hunt for all uses of [..]
with floats :) Maybe it's just me, but would guess that your students
would find it perfectly clear and not confusing at all... until they
found out about that little thing with 'last' above... *then* they
might be confused.
Maybe this is just an argument that Double's enumFromThenTo should use
multiplication instead of successive addition?
More information about the Haskell-Cafe
mailing list