RE: [Haskell-cafe] RE: Enum class

9 Jan
2005
9 Jan
'05
11:50 p.m.
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
7436
Age (days ago)
7436
Last active (days ago)
0 comments
1 participants
participants (1)
-
Arjun Guha