[Haskell] help with some basic code that doesn't work

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Feb 8 06:19:34 EST 2005

Matthew Walton <matthew at alledora.co.uk> writes:

> (==) works on types which are members of the Eq typeclass. You can 
> define this instance manually, or, since your type is nice and simple, 
> you can get Haskell to derive it for you.

Just a comment, since a couple of people have made similar statements.
Haskell will derive Eq for arbitrarily complex types - there is no
restriction to "simple" types, whatever they might be.  It will
always give you the "obvious" structural equality.  There /are/
occasions when structural equality is not quite what you want, but
that decision is entirely orthogonal to whether the type definition
is simple or complex.


More information about the Haskell mailing list