I need to compare two values of an "enumeration type" for equality. Say
the type definition is :: Enum = A | B | C. The only way I have found
to overload == on this type is the following:
instance == Enum
where
(==) s1 s2 = case (s1, s2) of
(A, A) = True
(B, B) = True
(C, C) = True
otherwise = False
Although this works (I have checked), it does seem clumsy and will get
less workable when the enumeration type has quite a few values more. Who
has a better idea?
Thanks again in advance.
Rudolf Meijer
_______________________________________________
clean-list mailing list
[email protected]
https://mailman.science.ru.nl/mailman/listinfo/clean-list