mirror of
https://github.com/github/semantic.git
synced 2024-11-28 18:23:44 +03:00
Perform the diff in the general case.
This commit is contained in:
parent
a76f645f63
commit
149b80e1da
11
src/SES.hs
11
src/SES.hs
@ -36,8 +36,15 @@ diffAt diffTerms cost (i, j) (a : as) (b : bs) = do
|
||||
case Map.lookup (i, j) cachedDiffs of
|
||||
Just diffs -> return diffs
|
||||
Nothing -> do
|
||||
put $ Map.insert (i, j) [] cachedDiffs
|
||||
return []
|
||||
down <- recur (i, succ j) as (b : bs)
|
||||
right <- recur (succ i, j) (a : as) bs
|
||||
nomination <- fmap best $ case diffTerms a b of
|
||||
Just diff -> do
|
||||
diagonal <- recur (succ i, succ j) as bs
|
||||
return $ [ delete down, insert right, consWithCost cost diff diagonal ]
|
||||
Nothing -> return [ delete down, insert right ]
|
||||
put $ Map.insert (i, j) nomination cachedDiffs
|
||||
return nomination
|
||||
where
|
||||
delete = consWithCost cost (Pure . Delete $ a)
|
||||
insert = consWithCost cost (Pure . Insert $ b)
|
||||
|
Loading…
Reference in New Issue
Block a user