nick8325 / quickcheck

Automatic testing of Haskell programs.
Other
713 stars 119 forks source link

Lightweight search for counterexamples using `sample'` #310

Closed amigalemming closed 5 months ago

amigalemming commented 4 years ago

I know of quickcheck-with-counterexamples but it needs extra instances. Thus I tried this one instead:

prop :: T -> Bool

counterExms <- filter (not . prop) <$> sample' arbitrary

However, sample' only generates ten examples, not hundred like quickCheck. Do you think it is possible and sensible to expand this idea to sampleWith :: Arg -> Gen a -> IO [a] and maybe also to Property instead of Bool?

I am happy with single-parameter predicates because I can uncurry predicates with multiple parameters. (I.e. no need for :&:.)

Related: #174