Tue, 23 Oct 2001 19:32:58 +1000 (EST)
Lennart Augustsson writes:
> "Ch. A. Herrmann" wrote:
> > (1) What is the justification for the types "Float" and "Double"
> > to be members of the type class "Enum"? This might induce students
> > to use floating point values as counters in arithmetic
> > sequences.
> And what's wrong with that? If the students are using are using values
> like 0.1 and expecting it to be represented exactly then they should have
> some lectures about floating point arithmetic.
Real numbers (which floating point numbers are trying to be) are not enumerable
(that is, they cannot be placed in a one-one correspondence with the integers).
> I've heard your complaint before, but I can't really understand why removing
> Float and Double from Enum would make Haskell any better for beginners.
> These two type have complicated properties, and to use them correctly you
> have to know about them. It's something you have to learn sooner or later.
> (In the the olden day when I had my first CS course we were told about it
> very early.)
I don't see it as a matter of ease of understanding for beginners. How can
floating point numbers be meaningfully enumerated (they could be enumerated by
treating their binary representation as an integer, but that is not meaningful)
? What is the "successor" of pi ?
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- Benjamin Franklin