Ranges and the Enum class

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Mar 21 04:08:34 EST 2006


Wolfgang Jeltsch <wolfgang at jeltsch.net> 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 serialisation routines, and they see
occasional use for other kinds of safe type coercion as well
    (toEnum .  fromEnum)

Regards,
    Malcolm


More information about the Haskell-prime mailing list