mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +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 Data.Map
|
||||
import Patch
|
||||
import SES
|
||||
|
||||
constructAndRun :: Term a Info -> Term a Info -> Maybe (Diff a)
|
||||
constructAndRun a b =
|
||||
@ -35,9 +36,7 @@ run (Free (ByKey a b f)) = run $ f byKey where
|
||||
inserted = (Pure . Insert) <$> difference b a
|
||||
patched = intersectionWith interpret a b
|
||||
|
||||
run (Free (ByIndex a b f)) = run $ f $ ses a b where
|
||||
ses a b | Prelude.null a = (Pure . Insert) <$> b
|
||||
ses a b | Prelude.null b = (Pure . Delete) <$> a
|
||||
run (Free (ByIndex a b f)) = run $ f $ ses a b
|
||||
|
||||
interpret :: Term a Info -> Term a Info -> Diff a
|
||||
interpret a b = maybeReplace $ constructAndRun a b where
|
||||
|
@ -1 +1,7 @@
|
||||
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