1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 21:16:12 +03:00

Go back to taking the absolute value, even tho it’s wrong.

This is still a poor approximation to the edit distance, but it’s a
better one than `sum`, and it’s still very cheap.
This commit is contained in:
Rob Rix 2016-06-03 15:29:28 -04:00
parent ec84afcadb
commit 410629b165

View File

@ -99,5 +99,5 @@ diffFiles parser renderer sourceBlobs = do
-- | The sum of the node count of the diffs patches.
diffCostWithCachedTermSizes :: Diff a Info -> Integer
diffCostWithCachedTermSizes diff = case runFree diff of
Free (info :< _) -> sum (cost <$> info)
Free (info :< _) -> abs $ runBothWith (-) (cost <$> info)
Pure patch -> sum (cost . extract <$> patch)