Suppose I have a record type:
data Foo = Foo {x, y, z :: Integer}
A neat way of writing an Arbitrary instance uses Control.Applicative like this:
instance Arbitrary Foo where
arbitrary = Foo <$> arbitrary <*> arbitrary <*> arbitrary
shrink f = Foo <$> shrink (x f) <*> shrink (y f) <*> shrink (z f)
The list of shrinks for a Foo is thus the cartesian product of all the shrinks of its members.
But if one of these shrinks returns [ ] then there will be no shrinks for the Foo as a whole. So this doesn't work.
I could try saving it by including the original value in the shrink list:
shrink f = Foo <$> ((x f) : shrink (x f)) <*> ... {and so on}.
But now shrink (Foo 0 0 0) will return [Foo 0 0 0], which means that shrinking will never terminate. So that doesn't work either.
It looks like there should be something other than <*> being used here, but I can't see what.