1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

renderToSymbols is pure.

This commit is contained in:
Rob Rix 2019-10-01 12:11:52 -04:00
parent f9c20bc462
commit 371e0c0945
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -34,7 +34,7 @@ legacyParseSymbols :: (Member Distribute sig, ParseEffects sig m, Traversable t)
legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap go blobs
where
go :: ParseEffects sig m => Blob -> m [Legacy.File]
go blob@Blob{..} = (doParse blob >>= withSomeTerm renderToSymbols) `catchError` (\(SomeException _) -> pure (pure emptyFile))
go blob@Blob{..} = (withSomeTerm renderToSymbols <$> doParse blob) `catchError` (\(SomeException _) -> pure (pure emptyFile))
where
emptyFile = tagsToFile []
@ -42,8 +42,8 @@ legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap
symbolsToSummarize :: [Text]
symbolsToSummarize = ["Function", "Method", "Class", "Module"]
renderToSymbols :: (IsTaggable f, Applicative m) => Term f Loc -> m [Legacy.File]
renderToSymbols = pure . pure . tagsToFile . Precise.tags blobSource . ALaCarteTerm (blobLanguage blob) symbolsToSummarize
renderToSymbols :: IsTaggable f => Term f Loc -> [Legacy.File]
renderToSymbols = pure . tagsToFile . Precise.tags blobSource . ALaCarteTerm (blobLanguage blob) symbolsToSummarize
tagsToFile :: [Tag] -> Legacy.File
tagsToFile tags = Legacy.File (pack (blobPath blob)) (pack (show (blobLanguage blob))) (fmap tagToSymbol tags)