Conditional properties in QuickCheck alter test data generation?

I'm learning QuickCheck, and I'm puzzled by the behavior I'm seeing with conditional properties. After writing and loading a simple qsort function from a separate file, I typed these into ghci: let prop_minimum xs = (length xs > 0) ==> head (qsort xs) == minimum xs where types = xs :: [Integer] let prop_minimum1 xs = (length xs > 3) ==> head (qsort xs) == minimum xs where types = xs :: [Integer] These differ only in that prop_minimum1 uses a more restrictive condition. Then quickCheck prop_minimum outputs "OK, passed 100 tests" but quickCheck prop_minimum1 outputs "Arguments exhausted after 0 tests" Investigating with verboseCheck yields puzzling results. For example, verboseCheck prop_minimum says "OK, passed 100 tests", but some of the test instances it shows have length 0, contrary to the condition... and a significant fraction of the test instances have length > 3, or even length > 10! So why the problem when running quickCheck on prop_minimum1? Running verboseCheck prop_minimum1 just deepens the mystery. Now we see most of the test instances generated having 0 length, and none of them having length > 3. What's going on here? Why is the distribution of generated test instances so drastically altered? BTW, I'm using ghc version 6.10.1, running on Intel Mac OS 10.5.5.

This bug appears to be fixed in QuickCheck 2. However, for some reason cabal-install by default only installs 1.2. You have to explicitly ask for the newer version: $ cabal install QuickCheck-2.1.0.1 -- Push the envelope. Watch it bend.

On Thu, Dec 18, 2008 at 3:09 PM, Thomas Schilling
This bug appears to be fixed in QuickCheck 2. However, for some reason cabal-install by default only installs 1.2. You have to explicitly ask for the newer version:
$ cabal install QuickCheck-2.1.0.1
cabal-install only installs 1.2 because QC 2 breaks a lot of packages (different function names, no coarbitrary, etc. IIRC). -- gwern

On Thu, 2008-12-18 at 20:09 +0000, Thomas Schilling wrote:
This bug appears to be fixed in QuickCheck 2. However, for some reason cabal-install by default only installs 1.2. You have to explicitly ask for the newer version:
$ cabal install QuickCheck-2.1.0.1
Or more generally: $ cabal install 'quickcheck >= 2' so you don't have to know exactly which version. I'm not quite sure what to do about these cases where we've added a global preference to keep old packages working but where it conflicts with the principle of least surprise. We don't necessarily want to just ignore the preference when the user asks for it on the command line because that prevents maintainers using it to allow stable and experimental versions of a package to be on hackage simultaneously. However QuickCheck seems to be a case where people now expect to use QC-2, but old packages that don't specify a version typically only work with QC-1.x. Duncan

On Thu, Dec 18, 2008 at 3:55 PM, Duncan Coutts
However QuickCheck seems to be a case where people now expect to use QC-2, but old packages that don't specify a version typically only work with QC-1.x.
Can't we just fix those .cabal files? --Max

On Thu, 2008-12-18 at 16:13 -0800, Max Rabkin wrote:
On Thu, Dec 18, 2008 at 3:55 PM, Duncan Coutts
wrote: However QuickCheck seems to be a case where people now expect to use QC-2, but old packages that don't specify a version typically only work with QC-1.x.
Can't we just fix those .cabal files?
We can certainly ask maintainers to specify the QC dependency properly when they next upload. We do not yet have a mechanism to update .cabal file dependencies on hackage after a package has been uploaded, though we have been pondering adding such a facility for a while. Duncan

Thanks. That took care of the problem with quickCheck, but now I have another problem: verboseCheck has disappeared! It doesn't seem to exist anymore in QuickCheck 2. I've looked over all the documentation I can find, but I can't any mention of this change. What replaces the functionality of verboseCheck in QuickCheck 2? On Dec 18, 2008, at 1:09 PM, Thomas Schilling wrote:
This bug appears to be fixed in QuickCheck 2. However, for some reason cabal-install by default only installs 1.2. You have to explicitly ask for the newer version:
$ cabal install QuickCheck-2.1.0.1
-- Push the envelope. Watch it bend.
participants (5)
-
Duncan Coutts
-
Gwern Branwen
-
Kevin Van Horn
-
Max Rabkin
-
Thomas Schilling