From 163f94b87e36950b3114ccc9d7c9d87f92db0639 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 22 Jul 2016 12:36:49 -0400 Subject: [PATCH] :memo: termCost. --- src/Diffing.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Diffing.hs b/src/Diffing.hs index 38081502c..3d4625a95 100644 --- a/src/Diffing.hs +++ b/src/Diffing.hs @@ -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)