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

Extract the annotation of Free terms.

This commit is contained in:
Rob Rix 2015-11-27 11:46:12 -05:00
parent b814e3c068
commit f4c73cb3f7

View File

@ -44,6 +44,8 @@ run comparable (Free (Recursive (annotation1 :< a) (annotation2 :< b) f)) = run
maybeInterpret _ _ = error "maybeInterpret assumes that its operands are `Just`s."
recur _ _ = Pure $ Replace (annotation1 :< a) (annotation2 :< b)
annotate = Free . Annotated (annotation1, annotation2)
run comparable (Free (ByKey a b f)) = run comparable $ f byKey where
byKey = unions [ deleted, inserted, patched ]
deleted = (Pure . Delete) <$> difference a b