1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

ArbitraryDiff is Arbitrary.

This commit is contained in:
Rob Rix 2015-12-11 16:06:14 -05:00
parent 86d95d1d86
commit c79113c18c

View File

@ -48,6 +48,9 @@ newtype ArbitraryDiff a annotation = ArbitraryDiff (ArbitraryTerm a annotation,
unDiff :: (Eq a, Eq annotation, Categorizable annotation) => ArbitraryDiff a annotation -> Diff a annotation unDiff :: (Eq a, Eq annotation, Categorizable annotation) => ArbitraryDiff a annotation -> Diff a annotation
unDiff (ArbitraryDiff (a, b)) = interpret comparable (unTerm a) (unTerm b) unDiff (ArbitraryDiff (a, b)) = interpret comparable (unTerm a) (unTerm b)
instance (Eq a, Eq annotation, Categorizable annotation, Arbitrary a, Arbitrary annotation) => Arbitrary (ArbitraryDiff a annotation) where
arbitrary = ArbitraryDiff <$> ((,) <$> arbitrary <*> arbitrary)
instance (Eq a, Eq annotation, Categorizable annotation, Arbitrary a, Arbitrary annotation) => Arbitrary (Diff a annotation) where instance (Eq a, Eq annotation, Categorizable annotation, Arbitrary a, Arbitrary annotation) => Arbitrary (Diff a annotation) where
arbitrary = interpret comparable <$> (unTerm <$> arbitrary) <*> (unTerm <$> arbitrary) arbitrary = interpret comparable <$> (unTerm <$> arbitrary) <*> (unTerm <$> arbitrary)