1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

unDiff interprets diffs.

This commit is contained in:
Rob Rix 2015-12-11 16:04:41 -05:00
parent 21b2d7fdfd
commit 86d95d1d86

View File

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