1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Recur through indexed terms of equal length.

This commit is contained in:
Rob Rix 2015-11-17 17:34:04 -08:00
parent e620eb76ff
commit e26dbb1fbe

View File

@ -16,7 +16,7 @@ run :: Algorithm a (Diff a) -> Maybe (Diff a)
run (Pure diff) = Just diff
run (Free (Recursive a b f)) = recur a b where
recur (_ :< Indexed a') (_ :< Indexed b') | length a' == length b' =
run $ f $ Pure Patch { old = Just a, new = Just b }
run $ f $ Free $ Indexed $ zipWith interpret a' b'
recur _ _ = run $ f $ Pure Patch { old = Just a, new = Just b }
interpret :: Term a Info -> Term a Info -> Diff a