1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 07:25:44 +03:00

Fix setCost infinite looping.

This commit is contained in:
Rob Rix 2016-06-17 13:53:33 -04:00
parent 1668e94427
commit 978c91cd59

View File

@ -97,7 +97,6 @@ diffFiles parser renderer sourceBlobs = do
pure $! renderer textDiff sourceBlobs pure $! renderer textDiff sourceBlobs
where construct :: CofreeF (Syntax Text) (Both Info) (Diff Text Info) -> Diff Text Info where construct :: CofreeF (Syntax Text) (Both Info) (Diff Text Info) -> Diff Text Info
construct (info :< syntax) = free (Free ((setCost <$> info <*> sumCost syntax) :< syntax)) construct (info :< syntax) = free (Free ((setCost <$> info <*> sumCost syntax) :< syntax))
setCost info cost = setCost info cost
sumCost = fmap getSum . foldMap (fmap Sum . getCost) sumCost = fmap getSum . foldMap (fmap Sum . getCost)
getCost diff = case runFree diff of getCost diff = case runFree diff of
Free (info :< _) -> cost <$> info Free (info :< _) -> cost <$> info