[QuickCheck] Shrinking a list

Michał Pałka michal.palka at chalmers.se
Thu Dec 20 18:06:36 GMT 2012


Hi Nick and Jurriën,

On Thu, 2012-12-20 at 17:24 +0100, Nick Smallbone wrote:
> 
> The reason why we don't make [0,0,0] directly shrink to [0] is, like
> you said, to reduce the number of shrink candidates we have to try. If
> a property fails on [0,0,0] and [0] it will probably fail on [0,0], so
> for most properties this doesn't cause a problem. And if shrinking
> really works badly, you can always define your own Arbitrary instance
> that shrinks how you want. 

In addition, if you want to use an existing shrinking function, but make
it try 2 steps at a time, you can use the Shrink2 modifier, which is
defined in Test.QuickCheck.Modifiers.
http://hackage.haskell.org/packages/archive/QuickCheck/2.5.1.1/doc/html/Test-QuickCheck-Modifiers.html

Best,
Michał




More information about the QuickCheck mailing list