Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Constrained.Examples.Fold
Synopsis
- oddSpec ∷ Specification Int
- evenSpec ∷ ∀ n. (TypeSpec n ~ NumSpec n, Integral n, HasSpec n, MaybeBounded n) ⇒ Specification n
- sum3WithLength ∷ Integer → Specification ([Int], Int, Int, Int)
- sum3 ∷ Specification [Int]
- listSumPair ∷ Numbery a ⇒ Specification [(a, Int)]
- listSumForall ∷ Numbery a ⇒ Specification [a]
- listSumComplex ∷ Numbery a ⇒ a → Specification [a]
- data Outcome
- propYes ∷ String → Solution t → Property
- propNo ∷ Show t ⇒ String → Solution t → Property
- parensList ∷ [String] → String
- logishProp ∷ Gen Property
- picktest ∷ (Ord a, Num a) ⇒ a → a → (a → Bool) → a → Int → [a] → Bool
- pickProp ∷ Gen Property
- testFoldSpec ∷ ∀ a. (Foldy a, Random a, Integral a, TypeSpec a ~ NumSpec a, Arbitrary a, MaybeBounded a) ⇒ Specification Integer → Specification a → Specification a → Outcome → Gen Property
- sumProp ∷ (Integral t, Random t, HasSpec t) ⇒ t → t → Specification t → t → Int → Outcome → Gen Property
- sumProp2 ∷ (Show t, Integral t, Random t) ⇒ t → t → (String, t → Bool) → t → Int → Outcome → Gen Property
Documentation
oddSpec ∷ Specification Int Source #
evenSpec ∷ ∀ n. (TypeSpec n ~ NumSpec n, Integral n, HasSpec n, MaybeBounded n) ⇒ Specification n Source #
sum3WithLength ∷ Integer → Specification ([Int], Int, Int, Int) Source #
sum3 ∷ Specification [Int] Source #
listSumPair ∷ Numbery a ⇒ Specification [(a, Int)] Source #
listSumForall ∷ Numbery a ⇒ Specification [a] Source #
listSumComplex ∷ Numbery a ⇒ a → Specification [a] Source #
Complicated, because if a
is too large, the spec is unsatisfiable.
parensList ∷ [String] → String Source #
testFoldSpec ∷ ∀ a. (Foldy a, Random a, Integral a, TypeSpec a ~ NumSpec a, Arbitrary a, MaybeBounded a) ⇒ Specification Integer → Specification a → Specification a → Outcome → Gen Property Source #
Build properties about calls to genListWithSize
sumProp ∷ (Integral t, Random t, HasSpec t) ⇒ t → t → Specification t → t → Int → Outcome → Gen Property Source #
Generate a property from a call to pickAll
. We can test for success or failure using outcome
sumProp2 ∷ (Show t, Integral t, Random t) ⇒ t → t → (String, t → Bool) → t → Int → Outcome → Gen Property Source #
Like SumProp, but instead of using a (Specification fn n) for the element predicate It uses an explicit pair of a (String, n -> Bool). This means we can test things using any Haskell function.