Eq package:leancheck

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.
Deprecated: Use isEquivalence.
This function can be used to define an Eq instance for functions based on testing and equality of returned values, like so:
instance (Listable a, Eq b) => Eq (a -> b) where
(==)  =  areEqualFor 12
This catches errors and undefined values and treats them as equal.
Is the given binary relation an equivalence? In other words, is the given relation reflexive, symmetric and transitive?
> check (isEquivalence (==) :: Int -> Int -> Int -> Bool)
+++ OK, passed 200 tests.
> check (isEquivalence (<=) :: Int -> Int -> Int -> Bool)
*** Failed! Falsifiable (after 3 tests):
0 1 0
Or, using Test.LeanCheck.Utils.TypeBinding:
> check $ isEquivalence (<=) -:> int
*** Failed! Falsifiable (after 3 tests):
0 1 0
Is this Eq instance valid? This is useful for testing your custom Eq instances against required properties. In particular, this function tests that == is an equivalence and that /= is the negation of ==.
> check $ (okEq :: Int -> Int -> Int -> Bool)
+++ OK, passed 200 tests.
> check $ (okEq :: Bool -> Bool -> Bool -> Bool)
+++ OK, passed 8 tests (exhausted).
Is this Eq and Ord instance valid and consistent? This is useful for testing your custom Eq and Ord instances against required properties.
> check $ (okEqOrd :: Int -> Int -> Int -> Bool)
+++ OK, passed 200 tests.
> check $ (okEqOrd :: Bool -> Bool -> Bool -> Bool)
+++ OK, passed 8 tests (exhausted).