[Haskell-cafe] QuickCheck - Extracting data values from tests

Jorge Adriano Aires jadrian at mat.uc.pt
Wed Sep 1 22:28:46 EDT 2004


Hello all,
When using Quickcheck, is there some way to extract generated data values to 
the IO Monad? 

I know I can collect and print information about test cases, but that's not 
enough. Data may be pretty complex, and there may be no parsers for it. If a 
test suddenly goes wrong, just having it displayed doesn't seem that useful.

I'd expect quickCheck to have type:
quickCheck :: forall a. (Testable a) => a -> IO [a]

Show I could just get the offending data with:
please_be_empty <- quickCheck prop_foo

Also, even when I'm implementing a generator, I want to see how it is working. 
Running a verboseCheck on some dummy property helps, but I may want to 
analyse the data, or some parts of it better - for instance, for many data 
structures I have alternative "show" functions that take parameters as 
arguments. 

Thanks in advance,
J.A.


More information about the Haskell-Cafe mailing list