pretty-ghci-0.2.0.0: haddock-test/ref/sample3.txt
The Eq class defines equality (==) and inequality (/=). All the basic datatypes
exported by the Prelude are instances of Eq, and Eq may be derived for any
datatype whose constituents are also instances of Eq.
The Haskell Report defines no laws for Eq. However, == is customarily expected
to implement an equivalence relationship where two values comparing equal are
indistinguishable by "public" functions, with a "public" function being one not
allowing to see implementation details. For example, for a type representing
non-normalised natural numbers modulo 100, a "public" function doesn't make the
difference between 1 and 201. It is expected to have the following properties:
Reflexivity:
x == x = True
Symmetry:
x == y = y == x
Transitivity:
if x == y && y == z = True, then x == z = True
Substitutivity:
if x == y = True and f is a "public" function
whose return type is an instance of Eq, then f x == f y = True
Negation:
x /= y = not (x == y)
Minimal complete definition: either == or /=.