1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Add an Arbitrary instance over Source.

This commit is contained in:
Rob Rix 2015-12-23 22:18:01 -05:00
parent 62143c1acf
commit 60aecae119

View File

@ -25,6 +25,9 @@ instance Arbitrary a => Arbitrary (Line a) where
Line <$> arbitrary,
const EmptyLine <$> (arbitrary :: Gen ()) ]
instance Arbitrary a => Arbitrary (Source a) where
arbitrary = makeSource <$> arbitrary
arbitraryLeaf :: Gen (String, Info, Syntax String f)
arbitraryLeaf = toTuple <$> arbitrary
where toTuple string = (string, Info (Range 0 $ length string) mempty, Leaf string)