8 Feb
2005
8 Feb
'05
11:19 a.m.
Matthew Walton <matthew@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. Regards, Malcolm