HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulecheckers-0.6.0Haskell2010

Test.QuickCheck.Checkers

Some QuickCheck helpers

  • 10 types
  • 3 classes
  • 37 values
  • Packagecheckers-0.6.0
  • Exports50
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCheckers.hs

Misc

16 declarations
typetype Unop a = a -> a
#

Unary function, handy for type annotations

typetype Binop a = a -> a -> a
#

Binary function, handy for type annotations

typetype T = Char
#

Token uninteresting type for tests

Generalized equality

20 declarations
classclass EqProp a where
#

Types of values that can be tested for equality, perhaps through random sampling.

Methods

Instances37EqProp, …
valuetransitive :: (Arbitrary a, Show a) => BinRel a -> (a -> Gen a) -> Property
#

Transitive property: a rel b && b rel c ==> a rel c. Generate a randomly, but use gen a to generate b and gen b to generate c. gen ought to satisfy rel fairly often.

valuesymmetric :: (Arbitrary a, Show a) => BinRel a -> (a -> Gen a) -> Property
#

Symmetric property: a rel b ==> b rel a. Generate a randomly, but use gen a to generate b. gen ought to satisfy rel fairly often.

valueidemElem :: EqProp a => (a -> a -> a) -> a -> Property
#

A binary function op is has an idempotent element x, i.e., x op x == x

Model-based (semantics-based) testing

10 declarations
classclass Model a b | a -> b where
#

Methods

Instances8Model, …
  • Model String StringDefined in checkers-0.6.0 · Test.QuickCheck.Checkers
  • Model Bool BoolDefined in checkers-0.6.0 · Test.QuickCheck.Checkers
  • Model Char CharDefined in checkers-0.6.0 · Test.QuickCheck.Checkers
  • Model Double DoubleDefined in checkers-0.6.0 · Test.QuickCheck.Checkers
  • Model Float FloatDefined in checkers-0.6.0 · Test.QuickCheck.Checkers
  • Model Int IntDefined in checkers-0.6.0 · Test.QuickCheck.Checkers
  • Model b b' => Model (a -> b) (a -> b')Defined in checkers-0.6.0 · Test.QuickCheck.Checkers
  • (Model a b, Model a' b') => Model (a, a') (b, b')Defined in checkers-0.6.0 · Test.QuickCheck.Checkers

Some handy testing types

4 declarations
valuegens :: Int -> Gen a -> IO [a]
#

Produce n values from a generator

value(.&.) :: (Testable prop1, Testable prop2) => prop1 -> prop2 -> Property
#

Nondeterministic choice: p1 .&. p2 picks randomly one of p1 and p2 to test. If you test the property 100 times it makes 100 random choices.

Orphan instances

2 instances