mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
Bind in the opposite direction.
This commit is contained in:
parent
02c19d1d93
commit
ed929f07a0
@ -27,9 +27,9 @@ unTerm arbitraryTerm = unfold unpack arbitraryTerm
|
||||
instance (Eq a, Eq f, Arbitrary a, Arbitrary f) => Arbitrary (Syntax a f) where
|
||||
shrink syntax = filter (/= syntax) $ shrinkSyntax syntax
|
||||
where shrinkSyntax (Leaf a) = Leaf <$> shrink a
|
||||
shrinkSyntax (Indexed i) = Indexed <$> (shrink =<< List.subsequences i)
|
||||
shrinkSyntax (Fixed f) = Fixed <$> (shrink =<< List.subsequences f)
|
||||
shrinkSyntax (Keyed k) = Keyed . Map.fromList <$> (shrink =<< List.subsequences (Map.toList k))
|
||||
shrinkSyntax (Indexed i) = Indexed <$> (List.subsequences i >>= shrink)
|
||||
shrinkSyntax (Fixed f) = Fixed <$> (List.subsequences f >>= shrink)
|
||||
shrinkSyntax (Keyed k) = Keyed . Map.fromList <$> (List.subsequences (Map.toList k) >>= shrink)
|
||||
|
||||
instance (Eq a, Eq annotation, Arbitrary a, Arbitrary annotation) => Arbitrary (ArbitraryTerm a annotation) where
|
||||
arbitrary = arbitraryBounded 4
|
||||
|
Loading…
Reference in New Issue
Block a user