From e5f34dccd32f5f608c25416a0033bc55a04a1a9c Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 11 Mar 2016 09:22:17 -0500 Subject: [PATCH] Scale the arbitrary term sizes down. --- test/ArbitraryTerm.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ArbitraryTerm.hs b/test/ArbitraryTerm.hs index acea61712..e4c65c362 100644 --- a/test/ArbitraryTerm.hs +++ b/test/ArbitraryTerm.hs @@ -20,7 +20,7 @@ unTerm = unfold unpack where unpack (ArbitraryTerm (annotation, syntax)) = (annotation, syntax) instance (Eq a, Eq annotation, Arbitrary a, Arbitrary annotation) => Arbitrary (ArbitraryTerm a annotation) where - arbitrary = sized (\ x -> boundedTerm x x) -- first indicates the cube of the max length of lists, second indicates the cube of the max depth of the tree + arbitrary = scale (`div` 2) $ sized (\ x -> boundedTerm x x) -- first indicates the cube of the max length of lists, second indicates the cube of the max depth of the tree where boundedTerm maxLength maxDepth = ArbitraryTerm <$> ((,) <$> arbitrary <*> boundedSyntax maxLength maxDepth) boundedSyntax _ maxDepth | maxDepth <= 0 = liftM Leaf arbitrary boundedSyntax maxLength maxDepth = frequency