HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulecheckers-0.6.0Haskell2010

Test.QuickCheck.Checkers

Some QuickCheck helpers

Contents
  1. Misc
  2. Generalized equality
  3. Model-based (semantics-based) testing
  4. Some handy testing types
Synopsis
  • Packagecheckers-0.6.0
  • Exports50
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCheckers.hs

Misc

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

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.

Model-based (semantics-based) testing

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

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