Ranges and the Enum class

Ross Paterson ross at soi.city.ac.uk
Fri Mar 17 12:49:11 EST 2006

On Fri, Mar 17, 2006 at 04:48:52PM +0000, Aaron Denney wrote:
> Sometime back on one of the other Haskell lists, there was a proposal
> to not have the floating types instances of Enum and instead have some
> other class to which [a, b..c] desugars.  That is, rename enumFromThen
> and friends and put them in another class.  Put simply, Float and Double
> should not support succ and pred (unless, perhaps, they map to the next
> greater/lesser representable number, which would also be confusing).
> I can even see an argument for not allowing Float or Double to be used
> for ranges either, as the steps may not be exact, which in practice
> turns out to be very confusing.

Speaking of confusing, try

	[0, 0.3 .. 2]::[Rational]

Also, toEnum and fromEnum would make more sense mapping from and to Integer.
It seems that succ and pred are unused.

More information about the Haskell-prime mailing list