1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 06:41:45 +03:00

📝 termCost.

This commit is contained in:
Rob Rix 2016-07-22 12:36:49 -04:00
parent 4447807bf6
commit 163f94b87e

View File

@ -114,6 +114,7 @@ diffFiles parser renderer sourceBlobs = do
Pure patch -> uncurry both (fromThese 0 0 (unPatch (cost . extract <$> patch)))
shouldCompareTerms = (==) `on` category . extract
-- | Compute the cost of an unpacked term.
termCost :: (Prologue.Foldable f, Functor f) => CofreeF f (Record a) (Record (Cost ': a)) -> Cost
termCost c = 1 + sum (cost <$> tailF c)