Re: Ranges and the Enum class

2006-03-21 Thread Malcolm Wallace
Wolfgang Jeltsch [EMAIL PROTECTED] writes: Also, toEnum and fromEnum would make more sense mapping from and to Integer. Why do we need toEnum and fromEnum at all? As far as I know, they are merely there to help people implement things like enumFrom. They are often useful for writing

Re: Ranges and the Enum class

2006-03-21 Thread Wolfgang Jeltsch
Am Dienstag, 21. März 2006 02:47 schrieb Aaron Denney: [...] No, I use them. In my opinion, it makes much more sense to write succ n than n + 1. Agreed, for non-arithmetical types. I think, it's perfectly sensible for arithmetical types like Integer. If you mean “the next integer” then

Re: Ranges and the Enum class

2006-03-21 Thread Wolfgang Jeltsch
Am Dienstag, 21. März 2006 10:08 schrieb Malcolm Wallace: Wolfgang Jeltsch [EMAIL PROTECTED] writes: [...] Why do we need toEnum and fromEnum at all? As far as I know, they are merely there to help people implement things like enumFrom. They are often useful for writing serialisation

Re: Ranges and the Enum class

2006-03-20 Thread Wolfgang Jeltsch
Am Freitag, 17. März 2006 18:49 schrieb Ross Paterson: [...] Also, toEnum and fromEnum would make more sense mapping from and to Integer. Why do we need toEnum and fromEnum at all? As far as I know, they are merely there to help people implement things like enumFrom. It's often not clear

Re: Ranges and the Enum class

2006-03-20 Thread Aaron Denney
On 2006-03-20, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Freitag, 17. März 2006 18:49 schrieb Ross Paterson: [...] Also, toEnum and fromEnum would make more sense mapping from and to Integer. Why do we need toEnum and fromEnum at all? As far as I know, they are merely there to help

Re: Ranges and the Enum class

2006-03-18 Thread Aaron Denney
On 2006-03-18, Jim Apple [EMAIL PROTECTED] wrote: On 3/18/06, Aaron Denney [EMAIL PROTECTED] wrote: Rational _could_ be added here by the diagonal representation, but probably sohuldn't. We could also add an actual enumeration of rationals, as in

Re: Ranges and the Enum class

2006-03-18 Thread Aaron Denney
On 2006-03-18, Aaron Denney [EMAIL PROTECTED] wrote: class ArithmeticSequence a where stepFrom :: a - [a]-- [n..] stepFromBy:: a - a - [a] -- [n,n'..] stepFromTo:: a - a - [a] -- [n..m] stepFromByTo :: a - a - a - [a] -- [n,n'..m]

Re: Ranges and the Enum class

2006-03-17 Thread Ross Paterson
On Fri, Mar 17, 2006 at 04:48:52PM +, 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

Re: Ranges and the Enum class

2006-03-17 Thread Aaron Denney
On 2006-03-17, Ross Paterson wrote: Speaking of confusing, try [0, 0.3 .. 2]::[Rational] Right. I had forgotten that -- Rational is exact, yet has the weird closest endpoint behavior of Float and Double. Also, toEnum and fromEnum would make more sense mapping from and to Integer. It