mirror of
https://github.com/github/semantic.git
synced 2024-11-24 17:04:47 +03:00
Compute the absolute difference of a diff as its cost.
This commit is contained in:
parent
d872b5ffff
commit
1d639ce8eb
@ -89,7 +89,7 @@ diffFiles parser renderer sourceBlobs = do
|
||||
diffCostWithCachedTermSizes :: Diff a Info -> Integer
|
||||
diffCostWithCachedTermSizes = diffSum (getSum . foldMap (Sum . size . copoint))
|
||||
|
||||
-- | The sum of the node count of the diff.
|
||||
diffCostWithCachedDiffSizes :: Diff a Info -> Integer
|
||||
diffCostWithCachedDiffSizes (Free (Annotated (Both (before, after)) _)) = size before + size after
|
||||
diffCostWithCachedDiffSizes (Pure patch) = sum $ size . copoint <$> patch
|
||||
-- | The absolute difference between the node counts of a diff.
|
||||
diffCostWithAbsoluteDifferenceOfCachedDiffSizes :: Diff a Info -> Integer
|
||||
diffCostWithAbsoluteDifferenceOfCachedDiffSizes (Free (Annotated (Both (before, after)) _)) = abs $ size before - size after
|
||||
diffCostWithAbsoluteDifferenceOfCachedDiffSizes (Pure patch) = sum $ size . copoint <$> patch
|
||||
|
Loading…
Reference in New Issue
Block a user