Ord package:leancheck

This optional module is part of LeanCheck, a simple enumerative property-based testing library. Toy Eq and Ord instance for functions.
instance (Listable a, Eq b) => Eq (a -> b) where
(==)  =  areEqualFor 12
instance (Listable a, Ord b) => Ord (a -> b) where
compare  =  compareFor 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.
Undefined Ordering value.
Takes as argument tiers of element values; returns tiers of unordered pairs where, in enumeration order, the first element is strictly less than the second. The returned element pairs can be seen as sets with two elements. When argument tiers are listed in Ord:
distinctPairs xss  =  xss >< xss  `suchThat` uncurry (<)
unorderedPairs by a given function:
unorderedDistinctPairsWith f  =  mapT (uncurry f) . unorderedDistinctPairs
Takes as argument tiers of element values; returns tiers of unordered pairs where, in enumeration order, the first element is less than or equal to the second. The name of this function is perhaps a misnomer. But in mathematics, an unordered pair is a pair where you don't care about element order, e.g.: (1,2) = (2,1). This function will enumerate canonical versions of such pairs where the first element is less than the second. The returned element pairs can be seen as bags with two elements. When argument tiers are listed in Ord:
distinctPairs xss  =  xss >< xss  `suchThat` uncurry (<=)
unorderedPairs by a given function:
unorderedPairsWith f  =  mapT (uncurry f) . unorderedPairs
Is the given binary relation a partial order? In other words, is the given relation reflexive, antisymmetric and transitive?
> check $ isPartialOrder ((<) :: Int->Int->Bool)
*** Failed! Falsifiable (after 1 tests):
0 0 0
> check $ isPartialOrder ((<=) :: Int->Int->Bool)
+++ OK, passed 200 tests.
> check $ isPartialOrder isSubsetOf
+++ OK, passed 200 tests.
Is the given binary relation a strict partial order? In other words, is the given relation irreflexive, asymmetric and transitive?
> check $ isStrictPartialOrder ((<) :: Int->Int->Bool)
+++ OK, passed 200 tests.
> check $ isStrictPartialOrder ((<=) :: Int->Int->Bool)
*** Failed! Falsifiable (after 1 tests):
0 0 0
Is the given binary relation a strict total order?
> check $ isStrictTotalOrder ((<=) :: Int->Int->Bool)
*** Failed! Falsifiable (after 1 tests):
0 0 0
> check $ isStrictTotalOrder ((<) :: Int->Int->Bool)
+++ OK, passed 200 tests.
Is the given binary relation a total order?
> check $ isTotalOrder ((<) :: Int->Int->Bool)
*** Failed! Falsifiable (after 1 tests):
0 0 0
> check $ isTotalOrder ((<=) :: Int->Int->Bool)
+++ OK, passed 200 tests.
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).
Is this Ord instance valid? This is useful for testing your custom Ord instances against required properties.
> check $ (okOrd :: Int -> Int -> Int -> Bool)
+++ OK, passed 200 tests.
> check $ (okOrd :: Bool -> Bool -> Bool -> Bool)
+++ OK, passed 8 tests (exhausted).
Deprecated: Use isPartialOrder.
Deprecated: Use isStrictPartialOrder.
Deprecated: Use isStrictTotalOrder.
Deprecated: Use isTotalOrder.
Undefined Word1 value.
Undefined Word2 value.
Undefined Word3 value.
Undefined Word4 value.
Single-bit unsigned integer: 0, 1
Two-bit unsigned integers: 0, 1, 2, 3
Three-bit unsigned integers: 0, 1, 2, 3, 4, 5, 6, 7