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

Revert "Use Info’s maybeCost definition."

This reverts commit 881e56b48bf186e996ff740412290f4786852e44.
This commit is contained in:
Rob Rix 2016-07-22 10:02:24 -04:00
parent 8c7ba2dadb
commit 7a4585d621
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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) =