A question about overloading

Rudolf Meijer via clean-list <[email protected]>
Newsgroups gmane.comp.lang.clean
Message-ID <em5b7efbc1-5459-43ef-8fe6-6764cd6b7054@surface8>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.