1
1
mirror of https://github.com/github/semantic.git synced 2025-01-08 16:39:47 +03:00

Slightly more tacit implementation of introduce.

This commit is contained in:
Rob Rix 2016-03-02 23:17:18 -05:00
parent 1ececaa837
commit d7c42c2f2b

View File

@ -40,7 +40,7 @@ hylo down up a = down annotation $ hylo down up <$> syntax where
constructAndRun :: (Eq a, Eq annotation) => Comparable a annotation -> Term a annotation -> Term a annotation -> Maybe (Diff a annotation)
constructAndRun _ a b | a == b = hylo introduce (copoint &&& unwrap) <$> zipTerms a b where
introduce :: Both annotation -> Syntax a (Diff a annotation) -> Diff a annotation
introduce ann syntax = Free $ Annotated ann syntax
introduce ann = Free . Annotated ann
constructAndRun comparable a b | not $ comparable a b = Nothing
constructAndRun comparable (annotation1 :< a) (annotation2 :< b) =
run comparable $ algorithm a b where