Eq

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, instances are encouraged to follow these properties:
  • Reflexivity x == x = True
  • Symmetry x == y = y == x
  • Transitivity if x == y && y == z = True, then x == z = True
  • Extensionality if x == y = True and f is a function whose return type is an instance of Eq, then f x == f y = True
  • Negation x /= y = not (x == y)
Equality
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, instances are encouraged to follow these properties:
  • Reflexivity x == x = True
  • Symmetry x == y = y == x
  • Transitivity if x == y && y == z = True, then x == z = True
  • Extensionality if x == y = True and f is a 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 /=.
int and float
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 /=.
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, instances are encouraged to follow these properties:
  • Reflexivity x == x = True
  • Symmetry x == y = y == x
  • Transitivity if x == y && y == z = True, then x == z = True
  • Extensionality if x == y = True and f is a 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 /=.
Eq properties You will need TypeApplications to use these.
We need a Haskell 98 type class which provides equality test for Vector type constructors.
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. Minimal complete definition: either == or /=.
Eq properties You will need TypeApplications to use these.
Correponds to Lua's equality (==) operator.
This optional module is part of LeanCheck, a simple enumerative property-based testing library. A toy Eq instance for functions.
instance (Listable a, Eq b) => Eq (a -> b) where
(==)  =  areEqualFor 12
This compares functions by testing them for up to 12 different values of each argument. Single argument functions are tested 12 times. Two argument functions are tested 144 times. Three argument functions are tested 1728 times. At each subsequent argument, number of tests and runtime increases 12-fold. To customize the number of tests, don't import this and use the above code changing the 12 value. Keep in mind that this value is number of tests for each argument. Warning: this is only intended to be used in testing modules. Avoid importing this on modules that are used as libraries as there is no way to unimport a typeclass instance.
Equality