[clean-list] generic equality?

Jerzy Karczmarczuk karczma at info.unicaen.fr
Mon Oct 25 12:01:42 MEST 2004


Forgive me a simplistic question.
Since in Clean there is no 'deriving' contraption as in Haskell, the
definition of (simple, identity) equality for instances of the data type

:: Dat = A | B | C | D | E | F | G | H | I | J | K | L | M | N | O   
//... etc.

is the complete set of:
(==) A A = True
...
(==) K K = True
...
(==) _ _  = False

which is heavy and inelegant. What are the ways to do it better? The manual
shows the example of generic constructs, e.g. for lists, which demand 
first the
conversion of an algebric datatype into sums/products which use Either, etc.
But with many alternatives the conversion function is also ugly. Do you 
have
any other ideas?

Thanks.

Jerzy Karczmarczuk



More information about the clean-list mailing list