diff --git a/src/Diffing.hs b/src/Diffing.hs index 926e39f32..85e4984ce 100644 --- a/src/Diffing.hs +++ b/src/Diffing.hs @@ -112,6 +112,8 @@ diffFiles parser renderer sourceBlobs = do getCost diff = fromMaybe 0 <$> case runFree diff of Free (info :< _) -> maybeCost <$> info Pure patch -> uncurry both (fromThese Nothing Nothing (unPatch (maybeCost . extract <$> patch))) + maybeCost :: Record fields -> Maybe Cost + maybeCost = maybeGetField shouldCompareTerms = (==) `on` category . extract termCost :: (Prologue.Foldable f, Functor f) => CofreeF f (Record a) (Record (Cost ': a)) -> Cost diff --git a/src/Renderer/Split.hs b/src/Renderer/Split.hs index 11e188206..a7ac1683e 100644 --- a/src/Renderer/Split.hs +++ b/src/Renderer/Split.hs @@ -122,6 +122,8 @@ instance (HasField fields Category, HasField fields Range) => ToMarkup (Renderab patchAttribute patch = A.class_ (splitPatchToClassName patch) withCostAttribute a c | Just (Cost c) <- c, c > 0 = a ! A.data_ (toValue c) | otherwise = identity + maybeCost :: Record fields -> Maybe Cost + maybeCost = maybeGetField instance ToMarkup a => ToMarkup (Cell a) where toMarkup (Cell hasChanges num line) =