1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00

Stub in recurring through indexed terms.

This commit is contained in:
Rob Rix 2015-11-17 17:29:18 -08:00
parent a30328e682
commit e620eb76ff

View File

@ -5,6 +5,7 @@ import Control.Monad.Free
import Control.Comonad.Cofree
import Operation
import Diff
import Syntax
constructAndRun :: Term a Info -> Term a Info -> Maybe (Diff a)
constructAndRun a b =
@ -14,6 +15,8 @@ constructAndRun a b =
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 }
recur _ _ = run $ f $ Pure Patch { old = Just a, new = Just b }
interpret :: Term a Info -> Term a Info -> Diff a