Proposal: free shrinking with QuickCheck

Reid Draper reiddraper at
Fri Nov 22 19:18:01 UTC 2013

On Nov 22, 2013, at 12:02 PM, Bryan O'Sullivan <bos at> wrote:

> On Thu, Nov 21, 2013 at 4:27 PM, Reid Draper <reiddraper at> wrote:
> I originally sent this message to the QuickCheck mailing list,
> but haven't heard anything in a while, and realized there are
> only ten subscribers. Below is the original message, any feedback
> appreciated.
> I don't love this idea on first reading. The move to switch to generating a rose tree seems rather intrusive and like it could put a lot of complexity right in the paths of developers. That being said, I'd be interested in seeing the idea fleshed out to the point of determining whether my worry has any teeth - could the end-user writing of an Arbitrary instance remain unaffected in practice?

I'll take a stab at a minimal implementation. The goal would certainly be for users to be able to simply delete their `shrink` function. If they were previously using the default (shrink _ = []), they'd then get shrinking for free. For those looking for more motivation, take a look at how boilerplate shrink implementations end up being in practice. Further, care must be given to respect any implicit constraints during shrinking, that are respected during generation. For example, when generating with `choose 10 20`, you must never shrink to a value below 10. This would all be taken care of using the proposed method.

a boolean logic solver:
pandoc, which doesn't have shrinking, conceivably it'd be quite tedious:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list