(I want to trim the headers, but don't know the history of this thread. Also cc:ed back to the Haskell list.) On Thu, Oct 25, 2001 at 11:11:42AM +0200, Ketil Malde wrote:
Dylan Thurston <dpt@math.harvard.edu> writes:
I agree that Enum instances for Float/Double are not likely to be useful.
From a gut feeling, I could see a use for expressions like
[1.5, 1.6..] and [1.5, 1.6..2.0]
(i.e. enumFromThen and enumFromThenTo) but enumFrom and enumFromTo making list of rounded integers seems strange to me.
It seems to me that enumFromThen and -To could be implemented something like:
enumFromThen beg next = beg : enumFromThen next (next+delta) where delta = next-beg
similarly for enumFromThenTo, of course.
i.e. depending only on functionality found in Num. Why not put these functions there, and remove Float and Double as Enum instances?
What am I missing?
Currently you can write data Day = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday weekdays = [Monday..Friday] which has nothing to do with Num. Best, Dylan Thurston