Shrinking
When Haskell's QuickCheck finds a failing input to a property, before displaying the failure it will attempt to shrink the input first. For instance a list of numbers that fails a particular property may be shrunk by having some of its elements removed or its elements shrunk. QuickCheck will keep trying to shrink falsifying cases until either 1) it can't shrink an input any further or 2) it runs out of time. This library should attempt to do the same. Possible approaches are:
-
Require a
shrinkfunction when constructing arbitraries. This function should return a lazy stream of shrunken versions of its input (lazy to avoid constructing thousands of shrunken versions of a large input before trying any of them). The "most shrunk" versions should appear first in the stream. -
Require a function that when applied to a value, produces a list of shrinking functions for that value. This represents that a value may be shrunk in different ways. This is what Hypothesis does. I'm not so sure about how this would work, but it seems like it may be better.