mirror of
https://github.com/github/semantic.git
synced 2024-12-21 13:51:44 +03:00
renderToSymbols is pure.
This commit is contained in:
parent
f9c20bc462
commit
371e0c0945
@ -34,7 +34,7 @@ legacyParseSymbols :: (Member Distribute sig, ParseEffects sig m, Traversable t)
|
|||||||
legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap go blobs
|
legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap go blobs
|
||||||
where
|
where
|
||||||
go :: ParseEffects sig m => Blob -> m [Legacy.File]
|
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
|
where
|
||||||
emptyFile = tagsToFile []
|
emptyFile = tagsToFile []
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap
|
|||||||
symbolsToSummarize :: [Text]
|
symbolsToSummarize :: [Text]
|
||||||
symbolsToSummarize = ["Function", "Method", "Class", "Module"]
|
symbolsToSummarize = ["Function", "Method", "Class", "Module"]
|
||||||
|
|
||||||
renderToSymbols :: (IsTaggable f, Applicative m) => Term f Loc -> m [Legacy.File]
|
renderToSymbols :: IsTaggable f => Term f Loc -> [Legacy.File]
|
||||||
renderToSymbols = pure . pure . tagsToFile . Precise.tags blobSource . ALaCarteTerm (blobLanguage blob) symbolsToSummarize
|
renderToSymbols = pure . tagsToFile . Precise.tags blobSource . ALaCarteTerm (blobLanguage blob) symbolsToSummarize
|
||||||
|
|
||||||
tagsToFile :: [Tag] -> Legacy.File
|
tagsToFile :: [Tag] -> Legacy.File
|
||||||
tagsToFile tags = Legacy.File (pack (blobPath blob)) (pack (show (blobLanguage blob))) (fmap tagToSymbol tags)
|
tagsToFile tags = Legacy.File (pack (blobPath blob)) (pack (show (blobLanguage blob))) (fmap tagToSymbol tags)
|
||||||
|
Loading…
Reference in New Issue
Block a user