From e0c11910befd96e9dfa98cd393e7d8799376c9af Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 18 Aug 2022 23:46:43 +1000 Subject: more linting of disambiguating --- src/HaskellCodeExplorer/PackageInfo.hs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src/HaskellCodeExplorer/PackageInfo.hs') 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 -- cgit v1.2.3