testing-type-modifiers

Data type modifiers for property based testing

LTS Haskell 23.0:0.1.0.1
Stackage Nightly 2024-12-13:0.1.0.1
Latest on Hackage:0.1.0.1

See all snapshots testing-type-modifiers appears in

LicenseRef-PublicDomain licensed by Jonas Duregård
Maintained by [email protected]
This version can be pinned in stack with:testing-type-modifiers-0.1.0.1@sha256:986ee8947b7c82a0879116cf7110f44b0ef62eb903dce3efaa1acbbe50dc779d,1898

Module documentation for 0.1.0.1

Depends on 1 package(full list with versions):
Used by 2 packages in lts-20.11(full list with versions):

Property based testing libraries such as QuickCheck tend to include type modifiers. Most of them are used to quantify over subsets of a type. For example a property on non-empty lists:

  prop_tail_length (NonEmpty xs) = length (tail xs) == length xs - 1

This library is intended to supply these modifiers to be used by testing libraries, in an effort to make properties more portable between testing frameworks.

For every modifier it also provides an access function that converts to the underlying type, which enables point-free style properties as such:

prop_tail_length2 = (> 0) . length . nonEmpty