mirror of
https://github.com/github/semantic.git
synced 2025-01-05 14:11:33 +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:
parent
ec84afcadb
commit
410629b165
@ -99,5 +99,5 @@ diffFiles parser renderer sourceBlobs = do
|
|||||||
-- | The sum of the node count of the diff’s patches.
|
-- | The sum of the node count of the diff’s patches.
|
||||||
diffCostWithCachedTermSizes :: Diff a Info -> Integer
|
diffCostWithCachedTermSizes :: Diff a Info -> Integer
|
||||||
diffCostWithCachedTermSizes diff = case runFree diff of
|
diffCostWithCachedTermSizes diff = case runFree diff of
|
||||||
Free (info :< _) -> sum (cost <$> info)
|
Free (info :< _) -> abs $ runBothWith (-) (cost <$> info)
|
||||||
Pure patch -> sum (cost . extract <$> patch)
|
Pure patch -> sum (cost . extract <$> patch)
|
||||||
|
Loading…
Reference in New Issue
Block a user