1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

Diff Array nodes byIndex.

This commit is contained in:
Rob Rix 2016-08-04 11:40:35 -04:00
parent a138cf5ec2
commit bb40b363ba

View File

@ -42,6 +42,7 @@ diffComparableTerms construct comparable cost = recur
algorithmWithTerms :: (TermF leaf (Both a) diff -> diff) -> Term leaf a -> Term leaf a -> Algorithm (Term leaf a) diff diff algorithmWithTerms :: (TermF leaf (Both a) diff -> diff) -> Term leaf a -> Term leaf a -> Algorithm (Term leaf a) diff diff
algorithmWithTerms construct t1 t2 = case (unwrap t1, unwrap t2) of algorithmWithTerms construct t1 t2 = case (unwrap t1, unwrap t2) of
(Indexed a, Indexed b) -> byIndex Indexed a b (Indexed a, Indexed b) -> byIndex Indexed a b
(Array a, Array b) -> byIndex Array a b
_ -> recursively t1 t2 _ -> recursively t1 t2
where annotate = pure . construct . (both (extract t1) (extract t2) :<) where annotate = pure . construct . (both (extract t1) (extract t2) :<)
byIndex constructor a b = Algorithm.byIndex a b >>= annotate . constructor byIndex constructor a b = Algorithm.byIndex a b >>= annotate . constructor