[Haskell-beginners] questions about quickCheck

Daniel Fischer daniel.is.fischer at web.de
Tue Nov 24 08:43:43 EST 2009

Am Dienstag 24 November 2009 08:00:52 schrieb Zsolt Ero:
> Hi,
> I have just started learning Haskell this semester, and I have some
> questions of things which puzzles me:
> 1. I would like to ask that how is it possible to set quickCheck test
> numbers to something else then the default 100 passes?

That depends on whether you're using QuickCheck 1.* or QuickCheck 2.*.

In 1.*, you'd use

customCheck p = check (defaultConfig{ configMaxTest = whatever }) p

-- perhaps you would also want to set other fields of the config, e.g. configMaxFail

In 2.*, things have been reorganised, so that QC 2.* is incompatible with 1.*, there you'd 

customCheck p = quickCheckWith (stdArgs{ maxSuccess = whatever }) p

-- perhaps you also want to set other fields of args, e.g. maxDiscard
> I have found an article which says:
> deepCheck p = check (defaultConfig { configMaxTest = 10000}) p
> which I tried and it works at a home Ubuntu install but when I tried
> it at my university network, it says:
> Not in scope: `check'
> Not in scope: `defaultConfig'
> Not in scope: `configMaxTest'

Probably QC 1.* at home, QC 2.* at the university.

> Isn't there a way of making quickCheck use a different number by using
> '==>' functions for example?

Not a good one.

> Is quickCheck p = check (defaultConfig) p?

In 1.*, yes, but indirectly.
You can verify such things yourself by looking at the docs + source in hackage, e.g.




> 2. How could I print the result of a complex quickCheck generator? I
> mean if there is an error is says it, but what if I would like to
> generate just random expressions which quickCheck can do?


perhaps you want to use verboseCheck in QC 1.* (prints out the tested data), look at QC 
2.*'s sources to find how to do it there, maybe sample' could be used.

> Zsolt

More information about the Beginners mailing list