[Haskell-cafe] RE: Enum class

Arjun Guha GUHAARJU at grinnell.edu
Sun Jan 9 23:50:11 EST 2005

Sorry, that was a stupid error.  I meant to use fromEnum:

> next:: (Enum a, Bounded a) => a -> a
> next v = if (fromEnum v) == (fromEnum maxBound)
>            then minBound
>            else succ v

I don't think this will quite work if fromEnum:: a -> Int for type a, were not 
injective.  However, that might be part of the specification... I don't 

It should be fine, so long as the preimage of (fromEnum maxBound) is 


Arjun Guha <guhaarju at grinnell.edu>

More information about the Haskell-Cafe mailing list