@@ -119,7 +119,7 @@ createExportsMap modIface = do
119
119
ExportsMap exportsMap $ buildModuleExportMap $ map (\ (_,b,c) -> (b, c)) exportList
120
120
where
121
121
doOne modIFace = do
122
- let getModDetails = unpackAvail $ moduleName $ mi_module modIFace
122
+ let getModDetails = unpackAvail ( moduleName $ mi_module modIFace) (mi_warns modIFace)
123
123
concatMap (fmap (second Set. fromList) . getModDetails) (mi_exports modIFace)
124
124
125
125
createExportsMapMg :: [ModGuts ] -> ExportsMap
@@ -129,8 +129,8 @@ createExportsMapMg modGuts = do
129
129
ExportsMap exportsMap $ buildModuleExportMap $ map (\ (_,b,c) -> (b, c)) exportList
130
130
where
131
131
doOne mi = do
132
- let getModuleName = moduleName $ mg_module mi
133
- concatMap (fmap (second Set. fromList) . unpackAvail getModuleName ) (mg_exports mi)
132
+ let getModDetails = unpackAvail ( moduleName $ mg_module mi) (mg_warns mi)
133
+ concatMap (fmap (second Set. fromList) . getModDetails ) (mg_exports mi)
134
134
135
135
updateExportsMapMg :: [ModGuts ] -> ExportsMap -> ExportsMap
136
136
updateExportsMapMg modGuts old = old' <> new
@@ -139,15 +139,15 @@ updateExportsMapMg modGuts old = old' <> new
139
139
old' = deleteAll old (Map. keys $ getModuleExportsMap new)
140
140
deleteAll = foldl' (flip deleteEntriesForModule)
141
141
142
- nonInternalModules :: ModuleName -> Bool
143
- nonInternalModules = not . (" .Internal" `isSuffixOf` ) . moduleNameString
142
+ isInternalModule :: ModuleName -> Bool
143
+ isInternalModule = (" .Internal" `isSuffixOf` ) . moduleNameString
144
144
145
145
type WithHieDb = forall a . (HieDb -> IO a ) -> IO a
146
146
147
147
createExportsMapHieDb :: WithHieDb -> IO ExportsMap
148
148
createExportsMapHieDb withHieDb = do
149
149
mods <- withHieDb getAllIndexedMods
150
- idents <- forM (filter (nonInternalModules . modInfoName . hieModInfo) mods) $ \ m -> do
150
+ idents <- forM (filter (not . isInternalModule . modInfoName . hieModInfo) mods) $ \ m -> do
151
151
let mn = modInfoName $ hieModInfo m
152
152
mText = pack $ moduleNameString mn
153
153
fmap (wrap . unwrap mText) <$> withHieDb (\ hieDb -> getExportsForModule hieDb mn)
@@ -161,10 +161,16 @@ createExportsMapHieDb withHieDb = do
161
161
n = pack (occNameString exportName)
162
162
p = pack . occNameString <$> exportParent
163
163
164
- unpackAvail :: ModuleName -> IfaceExport -> [(Text , Text , [IdentInfo ])]
165
- unpackAvail mn
166
- | nonInternalModules mn = map f . mkIdentInfos mod
167
- | otherwise = const []
164
+ unpackAvail :: ModuleName -> Warnings -> IfaceExport -> [(Text , Text , [IdentInfo ])]
165
+ unpackAvail mn warnings
166
+ | isInternalModule mn = const []
167
+ | otherwise = case warnings of
168
+ NoWarnings -> map f . mkIdentInfos mod
169
+ WarnAll {} -> const []
170
+ WarnSome deprThings -> do
171
+ let deprNames = Set. fromList $ fst <$> deprThings
172
+ notDeprecated = not . flip Set. member deprNames
173
+ map f . filter (notDeprecated . name) . mkIdentInfos mod
168
174
where
169
175
! mod = pack $ moduleNameString mn
170
176
f id @ IdentInfo {.. } = (printOutputable name, moduleNameText,[id ])
0 commit comments