The QuickCheckVariant package

[Tags:gpl, library]

Generator of valid and invalid data in a type class

[Skip to Readme]


Dependencies base (>4.6 && <5), QuickCheck [details]
License GPL-3
Author Jorge Santiago Alvarez Cuadros
Stability Unknown
Category Testing
Home page
Bug tracker
Source repository head: git clone
Uploaded Mon Jan 23 08:12:02 UTC 2017 by sanjorgek
Distributions NixOS:
Downloads 198 total (18 in the last 30 days)
0 []
Status Docs available [build log]
Last success reported on 2017-01-23 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for QuickCheckVariant

Readme for QuickCheckVariant-


Generator of "valid" and "invalid" data in a type class

For example, if you created

data Person = Anonymous { getId::String } | Client { getUsername::String, getName::String, getEmail::String} deriving(Show,Eq)

We can provide means to generate valid and invalid data, like:

instance Variant Person where
  valid = do
    id <- alternative
    username <- alternative
    name <- alternative
    domain <- alternative
    ext <- alternative
    (oneof . return) [Anonymous id, Client username name (username++"@"++domain++ext)]
  invalid = do
    username <- alternative
    name <- alternative
    return $ Client username name ""

See this post for more details