From 514c513f1335fafa412f62c41d002f71a5854291 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 31 May 2016 20:31:32 -0400 Subject: [PATCH] Simplify the definition of shrink over ArbitraryTerm. --- test/ArbitraryTerm.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ArbitraryTerm.hs b/test/ArbitraryTerm.hs index c3d10945d..a7352a3d7 100644 --- a/test/ArbitraryTerm.hs +++ b/test/ArbitraryTerm.hs @@ -37,11 +37,11 @@ instance (Eq a, Eq annotation, Arbitrary a, Arbitrary annotation) => Arbitrary ( (1, Keyed . Map.fromList . take maxLength <$> listOf (arbitrary >>= (\x -> (,) x <$> smallerTerm maxLength maxDepth))) ] smallerTerm maxLength maxDepth = boundedTerm (div maxLength 3) (div maxDepth 3) shrink term@(ArbitraryTerm (annotation :< syntax)) = (subterms term ++) $ filter (/= term) $ - ArbitraryTerm <$> ((:<) <$> shrink annotation <*> case syntax of + (ArbitraryTerm .) . (:<) <$> shrink annotation <*> case syntax of Leaf a -> Leaf <$> shrink a Indexed i -> Indexed <$> (List.subsequences i >>= recursivelyShrink) Fixed f -> Fixed <$> (List.subsequences f >>= recursivelyShrink) - Keyed k -> Keyed . Map.fromList <$> (List.subsequences (Map.toList k) >>= recursivelyShrink)) + Keyed k -> Keyed . Map.fromList <$> (List.subsequences (Map.toList k) >>= recursivelyShrink) data CategorySet = A | B | C | D deriving (Eq, Show)