mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Go back to Diff SES.
This commit is contained in:
parent
cb6eeff9e3
commit
6d6fbcf797
10
src/SES.hs
10
src/SES.hs
@ -2,8 +2,10 @@ module SES (ses) where
|
||||
|
||||
import Patch
|
||||
import Diff
|
||||
import Control.Monad.Free
|
||||
|
||||
ses :: Eq a => [a] -> [a] -> [Either (Patch a) (a, a)]
|
||||
ses [] b = (Left . Insert) <$> b
|
||||
ses a [] = (Left . Delete) <$> a
|
||||
ses (a : as) (b : bs) | a == b = Right (a, b) : ses as bs
|
||||
ses :: Functor f => Eq a => [a] -> [a] -> [Free f (Patch a)]
|
||||
ses [] b = (Pure . Insert) <$> b
|
||||
ses a [] = (Pure . Delete) <$> a
|
||||
ses (a : as) (b : bs) = case recur a b of
|
||||
Just f -> f : ses as bs
|
||||
|
Loading…
Reference in New Issue
Block a user