mirror of
https://github.com/github/semantic.git
synced 2024-12-26 08:25:19 +03:00
Move SES into its own file.
This commit is contained in:
parent
b122712470
commit
ae27e9cbbe
@ -8,6 +8,7 @@ import Diff
|
|||||||
import Syntax
|
import Syntax
|
||||||
import Data.Map
|
import Data.Map
|
||||||
import Patch
|
import Patch
|
||||||
|
import SES
|
||||||
|
|
||||||
constructAndRun :: Term a Info -> Term a Info -> Maybe (Diff a)
|
constructAndRun :: Term a Info -> Term a Info -> Maybe (Diff a)
|
||||||
constructAndRun a b =
|
constructAndRun a b =
|
||||||
@ -35,9 +36,7 @@ run (Free (ByKey a b f)) = run $ f byKey where
|
|||||||
inserted = (Pure . Insert) <$> difference b a
|
inserted = (Pure . Insert) <$> difference b a
|
||||||
patched = intersectionWith interpret a b
|
patched = intersectionWith interpret a b
|
||||||
|
|
||||||
run (Free (ByIndex a b f)) = run $ f $ ses a b where
|
run (Free (ByIndex a b f)) = run $ f $ ses a b
|
||||||
ses a b | Prelude.null a = (Pure . Insert) <$> b
|
|
||||||
ses a b | Prelude.null b = (Pure . Delete) <$> a
|
|
||||||
|
|
||||||
interpret :: Term a Info -> Term a Info -> Diff a
|
interpret :: Term a Info -> Term a Info -> Diff a
|
||||||
interpret a b = maybeReplace $ constructAndRun a b where
|
interpret a b = maybeReplace $ constructAndRun a b where
|
||||||
|
@ -1 +1,7 @@
|
|||||||
module SES where
|
module SES where
|
||||||
|
|
||||||
|
import Patch
|
||||||
|
import Control.Monad.Free
|
||||||
|
|
||||||
|
ses a b | Prelude.null a = (Pure . Insert) <$> b
|
||||||
|
ses a b | Prelude.null b = (Pure . Delete) <$> a
|
||||||
|
Loading…
Reference in New Issue
Block a user