Ranges and the Enum class

Wolfgang Jeltsch wolfgang at jeltsch.net
Mon Mar 20 18:31:16 EST 2006

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 
how toEnum and fromEnum should look like.  How should they be implemented for 
Time.Day, for example?  Should the days corresponds to the integers 0 to 6 or 
1 to 7?

> It seems that succ and pred are unused. 

No, I use them.  In my opinion, it makes much more sense to write succ n than 
n + 1.

Best wishes,

More information about the Haskell-prime mailing list