aboutsummaryrefslogtreecommitdiff
path: root/src/HaskellCodeExplorer/PackageInfo.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/HaskellCodeExplorer/PackageInfo.hs')
-rw-r--r--src/HaskellCodeExplorer/PackageInfo.hs29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/HaskellCodeExplorer/PackageInfo.hs b/src/HaskellCodeExplorer/PackageInfo.hs
index 8e0fbdf..7558fa2 100644
--- a/src/HaskellCodeExplorer/PackageInfo.hs
+++ b/src/HaskellCodeExplorer/PackageInfo.hs
@@ -286,16 +286,15 @@ createPackageInfo packageDirectoryPath mbDistDirRelativePath sourceCodePreproces
)
([], (HM.empty, HM.empty, HM.empty))
buildComponents
- let modId = HCE.id :: HCE.ModuleInfo -> HCE.HaskellModulePath
+ let modId (HCE.ModuleInfo {..}) = id
moduleMap =
HM.fromList
. map (\modInfo -> (modId modInfo, modInfo))
$ indexedModules
references = L.foldl' addReferencesFromModule HM.empty indexedModules
- moduleId = HCE.id :: HCE.ModuleInfo -> HCE.HaskellModulePath
topLevelIdentifiersTrie =
L.foldl' addTopLevelIdentifiersFromModule HCE.emptyTrie
- . L.filter (not . isHsBoot . moduleId)
+ . L.filter (not . isHsBoot . modId)
$ indexedModules
directoryTree <- liftIO $ buildDirectoryTree
packageDirectoryAbsPath
@@ -393,11 +392,9 @@ addReferencesFromModule references modInfo@HCE.ModuleInfo {..} =
eachIdentifierOccurrence
references
modInfo
- (\occMap lineNumber startCol endCol occ ->
- let mbIdExternalId = HCE.externalId =<< maybe
- Nothing
- (`HM.lookup` idInfoMap)
- (HCE.internalId (occ :: HCE.IdentifierOccurrence))
+ (\occMap lineNumber startCol endCol (HCE.IdentifierOccurrence {..}) ->
+ let mbIdExternalId =
+ HCE.externalId =<< maybe Nothing (`HM.lookup` idInfoMap) internalId
idSrcSpan = HCE.IdentifierSrcSpan { modulePath = id
, line = lineNumber
, startColumn = startCol
@@ -452,7 +449,7 @@ indexBuildComponent
-> [String] -- ^ Command-line options for GHC
-> [String] -- ^ Modules to compile
-> LoggingT IO ([HCE.ModuleInfo], ModuleDependencies)
-indexBuildComponent sourceCodePreprocessing currentPackageId componentId deps@(fileMap, defSiteMap, modNameMap) srcDirs libSrcDirs options modules
+indexBuildComponent sourceCodePreprocessing currentPackageId@HCE.PackageId { name = pkgName } componentId deps@(fileMap, defSiteMap, modNameMap) srcDirs libSrcDirs options modules
= do
let onError ex = do
logErrorN $ T.concat
@@ -491,13 +488,13 @@ indexBuildComponent sourceCodePreprocessing currentPackageId componentId deps@(f
setTargets targets
_ <- load LoadAllTargets
modGraph <- getModuleGraph
- let topSortMods = flattenSCCs $ filterToposortToModules
- (topSortModuleGraph False modGraph Nothing)
- buildDir =
- addTrailingPathSeparator . normalise . fromMaybe "" . hiDir $ flags'
- pathsModuleName = "Paths_" ++ map
- (\c -> if c == '-' then '_' else c)
- (T.unpack (HCE.name (currentPackageId :: HCE.PackageId)))
+ let
+ topSortMods = flattenSCCs $ filterToposortToModules
+ (topSortModuleGraph False modGraph Nothing)
+ buildDir =
+ addTrailingPathSeparator . normalise . fromMaybe "" . hiDir $ flags'
+ pathsModuleName =
+ "Paths_" ++ map (\c -> if c == '-' then '_' else c) (T.unpack pkgName)
(modSumWithPath, modulesNotFound) <-
(\(mods, notFound) ->
( L.reverse