From d5041aaf5eecaca30f9d54efc682e7437625a67a Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 11 Dec 2015 11:17:20 -0500 Subject: [PATCH] Shrink subterms recursively. --- test/Spec.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Spec.hs b/test/Spec.hs index fb1796960..512458acf 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -27,7 +27,7 @@ instance (Eq a, Eq annotation, Arbitrary a, Arbitrary annotation) => Arbitrary ( arbitrary = arbitraryBounded 4 shrink term@(ArbitraryTerm (annotation, syntax)) = filter (/= term) $ ArbitraryTerm <$> ((,) <$> shrink annotation <*> shrinkSyntax syntax) where shrinkSyntax (Leaf a) = Leaf <$> shrink a - shrinkSyntax (Indexed i) = (getSyntax <$> i) ++ (Indexed <$> List.subsequences i) + shrinkSyntax (Indexed i) = (getSyntax <$> i) ++ (Indexed <$> (shrink =<< List.subsequences i)) shrinkSyntax (Syntax.Fixed f) = (getSyntax <$> f) ++ (Syntax.Fixed <$> List.subsequences f) ++ (Syntax.Fixed <$> shrink f) shrinkSyntax (Keyed k) = (getSyntax . snd <$> (Map.toList k)) ++ (Keyed . Map.fromList <$> shrink (Map.toList k)) getSyntax (ArbitraryTerm (_, syntax)) = syntax