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

Language | Haskell2010 |

Properties of operations

## Synopsis

- 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

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

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

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

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)

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)