Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Some functions and generators suitable for writing QuickCheck properties.
- associative :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> a -> a -> Bool
- commutative :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> a -> Bool
- idempotent :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> Bool
- isZero :: (Arbitrary a, Eq a, Show a) => a -> (a -> a -> a) -> a -> Bool
- identity :: (Arbitrary a, Eq a, Show a) => a -> (a -> a -> a) -> a -> Bool
- leftDistributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool
- rightDistributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool
- distributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool
- natural :: Integral i => Gen i
- positive :: Integral i => Gen i
- maybeGen :: Gen a -> Gen (Maybe a)
- maybeCoGen :: (a -> Gen b -> Gen b) -> Maybe a -> Gen b -> Gen b
- listOfElements :: [a] -> Gen [a]
- elementsUnlessEmpty :: Arbitrary a => [a] -> Gen a
- two :: Gen a -> Gen (a, a)
- three :: Gen a -> Gen (a, a, a)
- runTests :: String -> [IO Bool] -> IO Bool
Algebraic properties
associative :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> a -> a -> Bool Source
Is the operator associative?
commutative :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> a -> Bool Source
Is the operator commutative?
idempotent :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> a -> Bool Source
Is the operator idempotent?
isZero :: (Arbitrary a, Eq a, Show a) => a -> (a -> a -> a) -> a -> Bool Source
Is the element a zero for the operator?
identity :: (Arbitrary a, Eq a, Show a) => a -> (a -> a -> a) -> a -> Bool Source
Is the element a unit for the operator?
leftDistributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool Source
Does the first operator distribute (from the left) over the second one?
rightDistributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool Source
Does the first operator distribute (from the right) over the second one?
distributive :: (Arbitrary a, Eq a, Show a) => (a -> a -> a) -> (a -> a -> a) -> a -> a -> a -> Bool Source
Does the first operator distribute over the second one?
Generators
maybeCoGen :: (a -> Gen b -> Gen b) -> Maybe a -> Gen b -> Gen b Source
Coarbitrary
"generator" for Maybe
.
listOfElements :: [a] -> Gen [a] Source
Generates a list of elements picked from a given list.
elementsUnlessEmpty :: Arbitrary a => [a] -> Gen a Source
If the given list is non-empty, then an element from the list is generated, and otherwise an arbitrary element is generated.