1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 18:36:27 +03:00

Don’t pattern match against the term functor.

This commit is contained in:
Rob Rix 2017-05-09 13:39:49 -04:00
parent aaf9b2b7d4
commit 0a522a386d

View File

@ -82,10 +82,10 @@ diffTOC blobs = removeDupes . diffToTOCSummaries >=> toJSONSummaries
(_, _) -> False
diffToTOCSummaries = para $ \diff -> case diff of
Free (Join (_, annotation) :< syntax)
| Just identifier <- identifierFor diffSource diffUnwrap syntax ->
foldMap (fmap (contextualize (Summarizable (category annotation) identifier (sourceSpan annotation) "modified")) . snd) syntax
| otherwise -> foldMap snd syntax
Free r
| Just identifier <- identifierFor diffSource diffUnwrap (tailF r) ->
foldMap (fmap (contextualize (Summarizable (category (Both.snd (headF r))) identifier (sourceSpan (Both.snd (headF r))) "modified")) . snd) r
| otherwise -> foldMap snd r
Pure patch -> fmap summarize (sequenceA (runBothWith mapPatch (toInfo . source <$> blobs) patch))
summarize patch = TOCSummary patch (infoCategory >>= summarizable)