I'm looking at the comments in shrink
:
It is tempting to write the last line as
[Branch x' l' r' | x' <- shrink x, l' <- shrink l, r' <- shrink r]
but this is the wrong thing! It will force QuickCheck to shrinkx
,l
andr
in tandem, and shrinking will stop once one of the three is fully shrunk.
I'm a bit puzzled about this, I thought that the problem with that shrink was that we're taking the cartesian product of the shrinks of the subterms, which might be quite large. I don't get why shrinking will stop once one of the three is fully shrunk.
So in other words, I thought the definition above would compute all combinations of shrinks of x
, l
, and r
, but I wouldn't expect shrink to stop once one the the terms is fully shrunk.