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 
remember.

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

-Arjun

--
Arjun Guha <[EMAIL PROTECTED]>

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to