mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Use the ordinary ArbitraryTerm constructor.
This commit is contained in:
parent
2cbe8959fe
commit
a7c959db6c
@ -35,13 +35,12 @@ instance (Arbitrary a, Arbitrary annotation) => Arbitrary (ArbitraryTerm a annot
|
||||
arbitrary = (\ annotation syntax -> ArbitraryTerm $ (annotation, unSyntax syntax)) <$> arbitrary <*> arbitrary
|
||||
|
||||
arbitraryBounded :: (Arbitrary a, Arbitrary annotation) => Int -> Gen (ArbitraryTerm a annotation)
|
||||
arbitraryBounded k = make <$> arbitrary <*> oneof [
|
||||
arbitraryBounded k = ArbitraryTerm <$> ((,) <$> arbitrary <*> oneof [
|
||||
Leaf <$> arbitrary,
|
||||
Indexed <$> vectorOfAtMost k (arbitraryBounded $ k - 1),
|
||||
Syntax.Fixed <$> vectorOfAtMost k (arbitraryBounded $ k - 1),
|
||||
Keyed . Map.fromList <$> arbitrary ]
|
||||
where make annotation syntax = ArbitraryTerm $ (annotation, syntax)
|
||||
vectorOfAtMost k gen = choose (0, k) >>= \n -> vectorOf n gen
|
||||
Keyed . Map.fromList <$> arbitrary ])
|
||||
where vectorOfAtMost k gen = choose (0, k) >>= \n -> vectorOf n gen
|
||||
|
||||
instance Arbitrary HTML where
|
||||
arbitrary = oneof [
|
||||
|
Loading…
Reference in New Issue
Block a user