A 'a Quickcheck.Shrinker.t
takes a value of type 'a
and produces similar values
that are smaller by some metric.
The defined shrinkers generally try to make a single change for each value based on the assumption that the first resulting value that preserves the desired property will be used to create another sequence of shrunk values.
Within Quickcheck.test
the shrinker is used as described above.
Shrinkers aim to aid understanding of what's causing an error by reducing the input down to just the elements making it fail. The default shrinkers remove elements of compound structures, but leave atomic values alone. For example, the default list shrinker tries removing elements from the list, but the default int shrinker does nothing. This default strikes a balance between performance and precision. Individual tests can use different shrinking behavior as necessary.
See lib/core/example/quickcheck/shrinker_example.ml for some example shrinkers.