Safe Haskell | None |
---|---|

Language | Haskell2010 |

- Tests for GenValidity instances
- Standard tests involving functions
- Properties of relations
- Properties of operations

## Synopsis

- module Data.GenValidity
- forAllUnchecked :: (Show a, GenUnchecked a, Testable prop) => (a -> prop) -> Property
- forAllValid :: (Show a, GenValid a, Testable prop) => (a -> prop) -> Property
- forAllInvalid :: (Show a, GenInvalid a, Testable prop) => (a -> prop) -> Property
- genGeneratesValid :: forall a. (Show a, Validity a) => Gen a -> Property
- genGeneratesInvalid :: forall a. (Show a, Validity a) => Gen a -> Property
- producesValidsOnGen :: forall a b. (Show a, Show b, Validity b) => (a -> b) -> Gen a -> (a -> [a]) -> Property
- producesValidsOnValids :: (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property
- producesValid :: (Show a, Show b, GenUnchecked a, Validity b) => (a -> b) -> Property
- producesValidsOnArbitrary :: (Show a, Show b, Arbitrary a, Validity b) => (a -> b) -> Property
- producesValidsOnGens2 :: (Show a, Show b, Show c, Validity c) => (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- producesValidsOnValids2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) => (a -> b -> c) -> Property
- producesValid2 :: (Show a, Show b, Show c, GenUnchecked a, GenUnchecked b, Validity c) => (a -> b -> c) -> Property
- producesValidsOnArbitrary2 :: (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c) => (a -> b -> c) -> Property
- producesValidsOnGens3 :: (Show a, Show b, Show c, Show d, Validity d) => (a -> b -> c -> d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- producesValidsOnValids3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d) => (a -> b -> c -> d) -> Property
- producesValid3 :: (Show a, Show b, Show c, Show d, GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d) => (a -> b -> c -> d) -> Property
- producesValidsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d) => (a -> b -> c -> d) -> Property
- class CanFail f where
- hasFailed :: f a -> Bool
- resultIfSucceeded :: f a -> Maybe a

- succeedsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- succeedsOnValid :: (Show a, Show b, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property
- succeeds :: (Show a, Show b, Show (f b), GenUnchecked a, CanFail f) => (a -> f b) -> Property
- succeedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property
- succeedsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- succeedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
- succeeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, CanFail f) => (a -> b -> f c) -> Property
- succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
- failsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- failsOnInvalid :: (Show a, Show b, Show (f b), GenInvalid a, CanFail f) => (a -> f b) -> Property
- failsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
- failsOnInvalid2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, GenInvalid a, GenInvalid b, CanFail f) => (a -> b -> f c) -> Property
- validIfSucceedsOnGen :: (Show a, Show b, Show (f b), Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- validIfSucceedsOnValid :: (Show a, Show b, Show (f b), GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
- validIfSucceedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
- validIfSucceeds :: (Show a, Show b, Show (f b), GenUnchecked a, Validity b, CanFail f) => (a -> f b) -> Property
- validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show (f c), Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- validIfSucceeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Show (f d), Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- validIfSucceedsOnValids3 :: (Show a, Show b, Show c, Show d, Show (f d), GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- validIfSucceeds3 :: (Show a, Show b, Show c, Show d, Show (f d), GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Show (f d), Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- equivalentOnGen :: (Show a, Eq a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- equivalentOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- equivalent :: (Show a, Eq a, GenUnchecked a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- equivalentOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- equivalentOnGens2 :: (Show a, Show b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- equivalentOnValids2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- equivalent2 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- equivalentOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- equivalentOnGens3 :: (Show a, Show b, Show c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- equivalentOnValids3 :: (Show a, GenValid a, Show b, GenValid b, Show c, GenValid c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- equivalent3 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, GenUnchecked c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- equivalentOnArbitrary3 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Arbitrary c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- equivalentWhenFirstSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- equivalentWhenFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- equivalentWhenFirstSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- equivalentWhenFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- equivalentWhenFirstSucceedsOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- equivalentWhenFirstSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- equivalentWhenFirstSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- equivalentWhenFirstSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- equivalentWhenSecondSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- equivalentWhenSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- equivalentWhenSecondSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- equivalentWhenSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- equivalentWhenSecondSucceedsOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- equivalentWhenSecondSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- equivalentWhenSecondSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- equivalentWhenSecondSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- equivalentWhenSucceedOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- equivalentWhenSucceedOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- equivalentWhenSucceed :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- equivalentWhenSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- equivalentWhenSucceedOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- equivalentWhenSucceedOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- equivalentWhenSucceed2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- equivalentWhenSucceedOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- inverseFunctionsOnGen :: (Show a, Eq a) => (a -> b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property
- inverseFunctionsOnValid :: (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property
- inverseFunctions :: (Show a, Eq a, GenUnchecked a) => (a -> b) -> (b -> a) -> Property
- inverseFunctionsOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b) -> (b -> a) -> Property
- inverseFunctionsIfFirstSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> f b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property
- inverseFunctionsIfFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- inverseFunctionsIfFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- inverseFunctionsIfSecondSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> b) -> (b -> f a) -> Gen a -> (a -> [a]) -> Property
- inverseFunctionsIfSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- inverseFunctionsIfSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- inverseFunctionsIfSucceedOnGen :: (Show a, Eq a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Gen a -> (a -> [a]) -> Property
- inverseFunctionsIfSucceedOnValid :: (Show a, Eq a, GenValid a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- inverseFunctionsIfSucceed :: (Show a, Eq a, GenUnchecked a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- inverseFunctionsIfSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- idempotentOnGen :: (Show a, Eq a) => (a -> a) -> Gen a -> (a -> [a]) -> Property
- idempotentOnValid :: (Show a, Eq a, GenValid a) => (a -> a) -> Property
- idempotent :: (Show a, Eq a, GenUnchecked a) => (a -> a) -> Property
- idempotentOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a) -> Property
- reflexiveOnElem :: (a -> a -> Bool) -> a -> Bool
- reflexivityOnGen :: Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property
- reflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- reflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- reflexivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- transitiveOnElems :: (a -> a -> Bool) -> a -> a -> a -> Bool
- transitivityOnGens :: Show a => (a -> a -> Bool) -> Gen (a, a, a) -> (a -> [a]) -> Property
- transitivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- transitivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- transitivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- antisymmetricOnElemsWithEquality :: (a -> a -> Bool) -> (a -> a -> Bool) -> a -> a -> Bool
- antisymmetryOnGensWithEquality :: Show a => (a -> a -> Bool) -> Gen (a, a) -> (a -> a -> Bool) -> (a -> [a]) -> Property
- antisymmetryOnGens :: (Show a, Eq a) => (a -> a -> Bool) -> Gen (a, a) -> (a -> [a]) -> Property
- antisymmetryOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property
- antisymmetry :: (Show a, Eq a, GenUnchecked a) => (a -> a -> Bool) -> Property
- antisymmetryOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> Bool) -> Property
- antireflexiveOnElem :: (a -> a -> Bool) -> a -> Bool
- antireflexivityOnGen :: Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property
- antireflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- antireflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- antireflexivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- symmetricOnElems :: (a -> a -> Bool) -> a -> a -> Bool
- symmetryOnGens :: Show a => (a -> a -> Bool) -> Gen (a, a) -> (a -> [a]) -> Property
- symmetryOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- symmetry :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- symmetryOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- leftIdentityOnElemWithEquality :: (b -> a -> a) -> (a -> a -> Bool) -> b -> a -> Bool
- leftIdentityOnGenWithEquality :: Show a => (b -> a -> a) -> (a -> a -> Bool) -> b -> Gen a -> (a -> [a]) -> Property
- leftIdentityOnGen :: (Show a, Eq a) => (b -> a -> a) -> b -> Gen a -> (a -> [a]) -> Property
- leftIdentityOnValid :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property
- leftIdentity :: (Show a, Eq a, GenUnchecked a) => (b -> a -> a) -> b -> Property
- leftIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (b -> a -> a) -> b -> Property
- rightIdentityOnElemWithEquality :: (a -> b -> a) -> (a -> a -> Bool) -> b -> a -> Bool
- rightIdentityOnGenWithEquality :: Show a => (a -> b -> a) -> (a -> a -> Bool) -> b -> Gen a -> (a -> [a]) -> Property
- rightIdentityOnGen :: (Show a, Eq a) => (a -> b -> a) -> b -> Gen a -> (a -> [a]) -> Property
- rightIdentityOnValid :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property
- rightIdentity :: (Show a, Eq a, GenUnchecked a) => (a -> b -> a) -> b -> Property
- rightIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b -> a) -> b -> Property
- identityOnGen :: (Show a, Eq a) => (a -> a -> a) -> a -> Gen a -> (a -> [a]) -> Property
- identityOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property
- identity :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> a -> Property
- identityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> a -> Property
- associativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a, a) -> ((a, a, a) -> [(a, a, a)]) -> Property
- associativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- associative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
- associativeOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property
- commutativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a) -> ((a, a) -> [(a, a)]) -> Property
- commutativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- commutative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
- commutativeOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property

# Documentation

module Data.GenValidity

forAllUnchecked :: (Show a, GenUnchecked a, Testable prop) => (a -> prop) -> Property Source #

forAllInvalid :: (Show a, GenInvalid a, Testable prop) => (a -> prop) -> Property Source #

# Tests for GenValidity instances

genGeneratesValid :: forall a. (Show a, Validity a) => Gen a -> Property Source #

The given generator generates only valid data points

genGeneratesInvalid :: forall a. (Show a, Validity a) => Gen a -> Property Source #

The given generator generates only invalid data points

# Standard tests involving functions

## Standard tests involving validity

producesValidsOnGen :: forall a b. (Show a, Show b, Validity b) => (a -> b) -> Gen a -> (a -> [a]) -> Property Source #

The function produces valid output when the input is generated as specified by the given generator.

producesValidsOnValids :: (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property Source #

The function produces valid output when the input is generated by
`genValid`

producesValid :: (Show a, Show b, GenUnchecked a, Validity b) => (a -> b) -> Property Source #

The function produces valid output when the input is generated by
`genUnchecked`

producesValidsOnArbitrary :: (Show a, Show b, Arbitrary a, Validity b) => (a -> b) -> Property Source #

The function produces valid output when the input is generated by
`arbitrary`

producesValidsOnGens2 :: (Show a, Show b, Show c, Validity c) => (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property Source #

producesValidsOnValids2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) => (a -> b -> c) -> Property Source #

producesValid2 :: (Show a, Show b, Show c, GenUnchecked a, GenUnchecked b, Validity c) => (a -> b -> c) -> Property Source #

producesValidsOnArbitrary2 :: (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c) => (a -> b -> c) -> Property Source #

producesValidsOnGens3 :: (Show a, Show b, Show c, Show d, Validity d) => (a -> b -> c -> d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property Source #

producesValidsOnValids3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d) => (a -> b -> c -> d) -> Property Source #

producesValid3 :: (Show a, Show b, Show c, Show d, GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d) => (a -> b -> c -> d) -> Property Source #

producesValidsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d) => (a -> b -> c -> d) -> Property Source #

## Standard tests involving functions that can fail

class CanFail f where Source #

A class of types that are the result of functions that can fail

succeedsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property Source #

The function succeeds if the input is generated by the given generator

succeedsOnValid :: (Show a, Show b, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property Source #

The function succeeds if the input is generated by `genValid`

succeeds :: (Show a, Show b, Show (f b), GenUnchecked a, CanFail f) => (a -> f b) -> Property Source #

The function succeeds if the input is generated by `genUnchecked`

succeedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property Source #

The function succeeds if the input is generated by `arbitrary`

succeedsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property Source #

succeedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property Source #

succeeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, CanFail f) => (a -> b -> f c) -> Property Source #

succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property Source #

failsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property Source #

The function fails if the input is generated by the given generator

failsOnInvalid :: (Show a, Show b, Show (f b), GenInvalid a, CanFail f) => (a -> f b) -> Property Source #

The function fails if the input is generated by `genInvalid`

failsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property Source #

failsOnInvalid2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, GenInvalid a, GenInvalid b, CanFail f) => (a -> b -> f c) -> Property Source #

validIfSucceedsOnGen :: (Show a, Show b, Show (f b), Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property Source #

The function produces output that satisfies `isValid`

if it is given input
that is generated by the given generator.

validIfSucceedsOnValid :: (Show a, Show b, Show (f b), GenValid a, Validity b, CanFail f) => (a -> f b) -> Property Source #

The function produces output that satisfies `isValid`

if it is given input
that is generated by `arbitrary`

.

validIfSucceedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property Source #

The function produces output that satisfies `isValid`

if it is given input
that is generated by `arbitrary`

.

validIfSucceeds :: (Show a, Show b, Show (f b), GenUnchecked a, Validity b, CanFail f) => (a -> f b) -> Property Source #

The function produces output that satisfies `isValid`

if it is given input
that is generated by `genUnchecked`

.

validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show (f c), Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property Source #

validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property Source #

validIfSucceeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, Validity c, CanFail f) => (a -> b -> f c) -> Property Source #

validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property Source #

validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Show (f d), Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property Source #

validIfSucceedsOnValids3 :: (Show a, Show b, Show c, Show d, Show (f d), GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property Source #

validIfSucceeds3 :: (Show a, Show b, Show c, Show d, Show (f d), GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property Source #

validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Show (f d), Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property Source #

## Standard tests involving equivalence of functions

### Simple functions

#### One argument

equivalentOnGen :: (Show a, Eq a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property Source #

equivalentOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property Source #

equivalent :: (Show a, Eq a, GenUnchecked a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property Source #

equivalentOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property Source #

equivalentOnArbitrary ((* 2) . (+ 1)) ((+ 2) . (* 2) :: Int -> Int)

#### Two arguments

equivalentOnGens2 :: (Show a, Show b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property Source #

equivalentOnValids2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property Source #

equivalent2 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property Source #

equivalentOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property Source #

equivalentOnArbitrary2 (+) ((+) :: Int -> Int -> Int)

#### Three arguments

equivalentOnGens3 :: (Show a, Show b, Show c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property Source #

equivalentOnValids3 :: (Show a, GenValid a, Show b, GenValid b, Show c, GenValid c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property Source #

equivalent3 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, GenUnchecked c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property Source #

equivalentOnArbitrary3 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Arbitrary c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property Source #

### First function can fail

#### One argument

equivalentWhenFirstSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property Source #

equivalentWhenFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property Source #

equivalentWhenFirstSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property Source #

equivalentWhenFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property Source #

#### Two arguments

equivalentWhenFirstSucceedsOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property Source #

equivalentWhenFirstSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property Source #

equivalentWhenFirstSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property Source #

equivalentWhenFirstSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property Source #

### Second function can fail

#### One argument

equivalentWhenSecondSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property Source #

equivalentWhenSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property Source #

equivalentWhenSecondSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property Source #

equivalentWhenSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property Source #

#### Two arguments

equivalentWhenSecondSucceedsOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property Source #

equivalentWhenSecondSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property Source #

equivalentWhenSecondSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property Source #

equivalentWhenSecondSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property Source #

### Both functions can fail

#### One argument

equivalentWhenSucceedOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property Source #

equivalentWhenSucceedOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property Source #

equivalentWhenSucceed :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property Source #

equivalentWhenSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property Source #

#### Two arguments

equivalentWhenSucceedOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property Source #

equivalentWhenSucceedOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property Source #

equivalentWhenSucceed2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property Source #

equivalentWhenSucceedOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property Source #

## Standard tests involving inverse functions

inverseFunctionsOnGen :: (Show a, Eq a) => (a -> b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property Source #

inverseFunctions :: (Show a, Eq a, GenUnchecked a) => (a -> b) -> (b -> a) -> Property Source #

inverseFunctionsOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b) -> (b -> a) -> Property Source #

`id`

is its own inverse function for every type:
prop> inverseFunctionsOnArbitrary id (id :: Int -> Int)

inverseFunctionsIfFirstSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> f b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property Source #

inverseFunctionsIfFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> f b) -> (b -> a) -> Property Source #

inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> f b) -> (b -> a) -> Property Source #

inverseFunctionsIfFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f) => (a -> f b) -> (b -> a) -> Property Source #

inverseFunctionsIfSecondSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> b) -> (b -> f a) -> Gen a -> (a -> [a]) -> Property Source #

inverseFunctionsIfSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> b) -> (b -> f a) -> Property Source #

inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> b) -> (b -> f a) -> Property Source #

inverseFunctionsIfSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f) => (a -> b) -> (b -> f a) -> Property Source #

inverseFunctionsIfSucceedOnGen :: (Show a, Eq a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Gen a -> (a -> [a]) -> Property Source #

inverseFunctionsIfSucceedOnValid :: (Show a, Eq a, GenValid a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property Source #

inverseFunctionsIfSucceed :: (Show a, Eq a, GenUnchecked a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property Source #

inverseFunctionsIfSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property Source #

## Properties involving idempotence

idempotent :: (Show a, Eq a, GenUnchecked a) => (a -> a) -> Property Source #

# Properties of relations

## Reflexivity

\[ Reflexive(\prec) \quad\equiv\quad \forall a: (a \prec a) \]

reflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property Source #

reflexivityOnValid ((<=) :: Rational -> Rational -> Bool)

reflexivityOnValid ((==) :: Rational -> Rational -> Bool)

reflexivityOnValid ((>=) :: Rational -> Rational -> Bool)

reflexivityOnValid (Data.List.isPrefixOf :: [Rational] -> [Rational] -> Bool)

reflexivityOnValid (Data.List.isSuffixOf :: [Rational] -> [Rational] -> Bool)

reflexivityOnValid (Data.List.isInfixOf :: [Rational] -> [Rational] -> Bool)

reflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property Source #

reflexivity ((<=) :: Int -> Int -> Bool)

reflexivity ((==) :: Int -> Int -> Bool)

reflexivity ((>=) :: Int -> Int -> Bool)

reflexivity (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool)

reflexivity (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool)

reflexivity (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)

reflexivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property Source #

reflexivityOnArbitrary ((<=) :: Int -> Int -> Bool)

reflexivityOnArbitrary ((==) :: Int -> Int -> Bool)

reflexivityOnArbitrary ((>=) :: Int -> Int -> Bool)

reflexivityOnArbitrary (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool)

reflexivityOnArbitrary (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool)

reflexivityOnArbitrary (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)

## Transitivity

\[ Transitive(\prec) \quad\equiv\quad \forall a, b, c: ((a \prec b) \wedge (b \prec c)) \Rightarrow (a \prec c) \]

transitivityOnGens :: Show a => (a -> a -> Bool) -> Gen (a, a, a) -> (a -> [a]) -> Property Source #

transitivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property Source #

transitivityOnValid ((>) :: Double -> Double -> Bool)

transitivityOnValid ((>=) :: Double -> Double -> Bool)

transitivityOnValid ((==) :: Double -> Double -> Bool)

transitivityOnValid ((<=) :: Double -> Double -> Bool)

transitivityOnValid ((<) :: Double -> Double -> Bool)

transitivityOnValid (Data.List.isPrefixOf :: [Double] -> [Double] -> Bool)

transitivityOnValid (Data.List.isSuffixOf :: [Double] -> [Double] -> Bool)

transitivityOnValid (Data.List.isInfixOf :: [Double] -> [Double] -> Bool)

transitivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property Source #

transitivity ((>) :: Int -> Int -> Bool)

transitivity ((>=) :: Int -> Int -> Bool)

transitivity ((==) :: Int -> Int -> Bool)

transitivity ((<=) :: Int -> Int -> Bool)

transitivity ((<) :: Int -> Int -> Bool)

transitivity (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool)

transitivity (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool)

transitivity (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)

transitivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property Source #

transitivityOnArbitrary ((>) :: Int -> Int -> Bool)

transitivityOnArbitrary ((>=) :: Int -> Int -> Bool)

transitivityOnArbitrary ((==) :: Int -> Int -> Bool)

transitivityOnArbitrary ((<=) :: Int -> Int -> Bool)

transitivityOnArbitrary ((<) :: Int -> Int -> Bool)

transitivityOnArbitrary (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool)

transitivityOnArbitrary (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool)

transitivityOnArbitrary (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)

## Antisymmetry

antisymmetricOnElemsWithEquality Source #

\[ Antisymmetric(\prec, \doteq) \quad\equiv\quad \forall a, b: ((a \prec b) \wedge (b \prec a)) \Rightarrow (a \doteq b) \]

antisymmetryOnGensWithEquality :: Show a => (a -> a -> Bool) -> Gen (a, a) -> (a -> a -> Bool) -> (a -> [a]) -> Property Source #

antisymmetryOnGens :: (Show a, Eq a) => (a -> a -> Bool) -> Gen (a, a) -> (a -> [a]) -> Property Source #

antisymmetryOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property Source #

antisymmetryOnValid ((>) :: Double -> Double -> Bool)

antisymmetryOnValid ((>=) :: Double -> Double -> Bool)

antisymmetryOnValid ((<=) :: Double -> Double -> Bool)

antisymmetryOnValid ((<) :: Double -> Double -> Bool)

antisymmetryOnValid (Data.List.isPrefixOf :: [Double] -> [Double] -> Bool)

antisymmetryOnValid (Data.List.isSuffixOf :: [Double] -> [Double] -> Bool)

antisymmetryOnValid (Data.List.isInfixOf :: [Double] -> [Double] -> Bool)

antisymmetry :: (Show a, Eq a, GenUnchecked a) => (a -> a -> Bool) -> Property Source #

antisymmetry ((>) :: Int -> Int -> Bool)

antisymmetry ((>=) :: Int -> Int -> Bool)

antisymmetry ((<=) :: Int -> Int -> Bool)

antisymmetry ((<) :: Int -> Int -> Bool)

antisymmetry (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool)

antisymmetry (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool)

antisymmetry (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)

antisymmetry ((\x y -> even x && odd y) :: Int -> Int -> Bool)

antisymmetryOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> Bool) -> Property Source #

antisymmetryOnArbitrary ((>) :: Int -> Int -> Bool)

antisymmetryOnArbitrary ((>=) :: Int -> Int -> Bool)

antisymmetryOnArbitrary ((<=) :: Int -> Int -> Bool)

antisymmetryOnArbitrary ((<) :: Int -> Int -> Bool)

antisymmetryOnArbitrary (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool)

antisymmetryOnArbitrary (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool)

antisymmetryOnArbitrary (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)

antisymmetryOnArbitrary ((\x y -> even x && odd y) :: Int -> Int -> Bool)

## Antireflexivity

\[ Antireflexive(\prec) \quad\equiv\quad \forall a: \neg (a \prec a) \]

antireflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property Source #

antireflexivityOnValid ((<) :: Rational -> Rational -> Bool)

antireflexivityOnValid ((/=) :: Rational -> Rational -> Bool)

antireflexivityOnValid ((>) :: Rational -> Rational -> Bool)

antireflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property Source #

antireflexivity ((<) :: Int -> Int -> Bool)

antireflexivity ((/=) :: Int -> Int -> Bool)

antireflexivity ((>) :: Int -> Int -> Bool)

antireflexivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property Source #

antireflexivityOnArbitrary ((<) :: Int -> Int -> Bool)

antireflexivityOnArbitrary ((/=) :: Int -> Int -> Bool)

antireflexivityOnArbitrary ((>) :: Int -> Int -> Bool)

## Symmetry

\[ Symmetric(\prec) \quad\equiv\quad \forall a, b: (a \prec b) \Leftrightarrow (b \prec a) \]

symmetryOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property Source #

symmetryOnValid ((==) :: Double -> Double -> Bool)

symmetryOnValid ((/=) :: Double -> Double -> Bool)

symmetry :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property Source #

symmetry ((==) :: Int -> Int -> Bool)

symmetry ((/=) :: Int -> Int -> Bool)

symmetryOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property Source #

symmetryOnArbitrary ((==) :: Int -> Int -> Bool)

symmetryOnArbitrary ((/=) :: Int -> Int -> Bool)

# Properties of operations

## Identity element

### Left Identity

leftIdentityOnElemWithEquality Source #

:: (b -> a -> a) | A binary operation |

-> (a -> a -> Bool) | An equality |

-> b | A candidate left-identity |

-> a | An element |

-> Bool |

\[ LeftIdentity(\star, \doteq, b) \quad\equiv\quad \forall a: (b \star a) \doteq a \]

leftIdentityOnValid :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property Source #

leftIdentityOnValid (flip ((^) :: Rational -> Int -> Rational)) 1

leftIdentity :: (Show a, Eq a, GenUnchecked a) => (b -> a -> a) -> b -> Property Source #

leftIdentity (flip ((^) :: Int -> Int -> Int)) 1

leftIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (b -> a -> a) -> b -> Property Source #

leftIdentityOnArbitrary (flip ((^) :: Int -> Int -> Int)) 1

### Right Identity

rightIdentityOnElemWithEquality Source #

:: (a -> b -> a) | A binary operation |

-> (a -> a -> Bool) | An equality |

-> b | A candidate right-identity |

-> a | An element |

-> Bool |

\[ RightIdentity(\star, \doteq, b) \quad\equiv\quad \forall a: (a \star b) \doteq a \]

rightIdentityOnValid :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property Source #

rightIdentityOnValid ((^) :: Rational -> Int -> Rational) 1

rightIdentity :: (Show a, Eq a, GenUnchecked a) => (a -> b -> a) -> b -> Property Source #

rightIdentity ((^) :: Int -> Int -> Int) 1

rightIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b -> a) -> b -> Property Source #

rightIdentityOnArbitrary ((^) :: Int -> Int -> Int) 1

### Identity

identityOnGen :: (Show a, Eq a) => (a -> a -> a) -> a -> Gen a -> (a -> [a]) -> Property Source #

\[ Identity(\star, \doteq, b) \quad\equiv\quad LeftIdentity(\star, \doteq, b) \wedge RightIdentity(\star, \doteq, b) \]

identityOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property Source #

identityOnValid ((*) :: Rational -> Rational -> Rational) 1

identityOnValid ((+) :: Rational -> Rational -> Rational) 0

identity :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> a -> Property Source #

identity ((*) :: Int -> Int -> Int) 1

identity ((+) :: Int -> Int -> Int) 0

identityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> a -> Property Source #

identityOnArbitrary ((*) :: Int -> Int -> Int) 1

identityOnArbitrary ((+) :: Int -> Int -> Int) 0

## Associativity

associativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a, a) -> ((a, a, a) -> [(a, a, a)]) -> Property Source #

\[ Associative(\star) \quad\equiv\quad \forall a, b, c: (a \star b) \star c = a \star (b \star c) \]

associative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property Source #

associative ((*) :: Int -> Int -> Int)

associative ((+) :: Int -> Int -> Int)

associativeOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property Source #

associativeOnArbitrary ((*) :: Int -> Int -> Int)

associativeOnArbitrary ((+) :: Int -> Int -> Int)

## Commutativity

commutativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a) -> ((a, a) -> [(a, a)]) -> Property Source #

\[ Commutative(\star) \quad\equiv\quad \forall a, b: a \star b = b \star a \]

commutativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property Source #

commutativeOnValids ((+) :: Rational -> Rational -> Rational)

commutativeOnValids ((*) :: Rational -> Rational -> Rational)

commutative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property Source #

commutative ((+) :: Int -> Int -> Int)

commutative ((*) :: Int -> Int -> Int)