From e185f5ae9c9470b861916aa96933fa72cd703a4e Mon Sep 17 00:00:00 2001 From: David Waern Date: Thu, 30 Aug 2007 16:30:37 +0000 Subject: Rename HaddockModule to Interface --- src/Haddock/Interface/AttachInstances.hs | 6 ++-- src/Haddock/Interface/Create.hs | 48 ++++++++++++++++---------------- src/Haddock/Interface/Rename.hs | 20 ++++++------- 3 files changed, 37 insertions(+), 37 deletions(-) (limited to 'src/Haddock/Interface') diff --git a/src/Haddock/Interface/AttachInstances.hs b/src/Haddock/Interface/AttachInstances.hs index 51c531e1..8e81d8a6 100644 --- a/src/Haddock/Interface/AttachInstances.hs +++ b/src/Haddock/Interface/AttachInstances.hs @@ -32,9 +32,9 @@ attachInstances :: [Interface] -> [Interface] attachInstances modules = map attach modules where instMap = fmap (map toHsInstHead . sortImage instHead) $ collectInstances modules - attach mod = mod { hmod_export_items = newItems } + attach mod = mod { ifaceExportItems = newItems } where - newItems = map attachExport (hmod_export_items mod) + newItems = map attachExport (ifaceExportItems mod) attachExport (ExportDecl n decl doc _) = ExportDecl n decl doc (case Map.lookup n instMap of @@ -56,7 +56,7 @@ collectInstances modules = Map.fromListWith (flip (++)) tyInstPairs `Map.union` Map.fromListWith (flip (++)) classInstPairs where - allInstances = concat (map hmod_instances modules) + allInstances = concat (map ifaceInstances modules) classInstPairs = [ (is_cls inst, [instanceHead inst]) | inst <- allInstances ] tyInstPairs = [ (tycon, [instanceHead inst]) | inst <- allInstances, diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index 161b2851..604d49fb 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -82,22 +82,22 @@ createInterface ghcMod flags modMap = do | otherwise = exportItems return Interface { - hmod_mod = mod, - hmod_orig_filename = ghcFilename ghcMod, - hmod_info = ghcHaddockModInfo ghcMod, - hmod_doc = ghcMbDoc ghcMod, - hmod_rn_doc = Nothing, - hmod_options = opts, - hmod_locals = localNames, - hmod_doc_map = docMap, - hmod_rn_doc_map = Map.empty, - hmod_sub_map = subMap, - hmod_export_items = prunedExportItems, - hmod_rn_export_items = [], - hmod_exports = ghcExportedNames ghcMod, - hmod_visible_exports = visibleNames, - hmod_exported_decl_map = expDeclMap, - hmod_instances = ghcInstances ghcMod + ifaceMod = mod, + ifaceOrigFilename = ghcFilename ghcMod, + ifaceInfo = ghcHaddockModInfo ghcMod, + ifaceDoc = ghcMbDoc ghcMod, + ifaceRnDoc = Nothing, + ifaceOptions = opts, + ifaceLocals = localNames, + ifaceDocMap = docMap, + ifaceRnDocMap = Map.empty, + ifaceSubMap = subMap, + ifaceExportItems = prunedExportItems, + ifaceRnExportItems = [], + ifaceExports = ghcExportedNames ghcMod, + ifaceVisibleExports = visibleNames, + ifaceExportedDeclMap = expDeclMap, + ifaceInstances = ghcInstances ghcMod } @@ -404,9 +404,9 @@ mkExportItems lookupMod this_mod exported_names exportedDeclMap localDeclMap sub | m == this_mod = return (fullContentsOfThisModule this_mod entities localDeclMap docMap) | otherwise = case lookupMod m of - Just hmod - | OptHide `elem` hmod_options hmod - -> return (hmod_export_items hmod) + Just iface + | OptHide `elem` ifaceOptions iface + -> return (ifaceExportItems iface) | otherwise -> return [ ExportModule m ] Nothing -> return [] -- already emitted a warning in visibleNames @@ -416,8 +416,8 @@ mkExportItems lookupMod this_mod exported_names exportedDeclMap localDeclMap sub | m == this_mod = (Map.lookup n exportedDeclMap, Map.lookup n docMap) | otherwise = case lookupMod m of - Just hmod -> (Map.lookup n (hmod_exported_decl_map hmod), - Map.lookup n (hmod_doc_map hmod)) + Just iface -> (Map.lookup n (ifaceExportedDeclMap iface), + Map.lookup n (ifaceDocMap iface)) Nothing -> (Nothing, Nothing) where m = nameModule n @@ -539,8 +539,8 @@ mkVisibleNames mdl lookupMod localNames scope subMap maybeExps opts declMap | otherwise -> let m' = mkModule (modulePackageId mdl) m in case lookupMod m' of Just mod - | OptHide `elem` hmod_options mod -> - return (filter (`elem` scope) (hmod_exports mod)) + | OptHide `elem` ifaceOptions mod -> + return (filter (`elem` scope) (ifaceExports mod)) | otherwise -> return [] Nothing -> tell (exportModuleMissingErr mdl m') >> return [] @@ -560,7 +560,7 @@ allSubsOfName :: LookupMod -> Name -> [Name] allSubsOfName lookupMod name | isExternalName name = case lookupMod (nameModule name) of - Just hmod -> Map.findWithDefault [] name (hmod_sub_map hmod) + Just iface -> Map.findWithDefault [] name (ifaceSubMap iface) Nothing -> [] | otherwise = error $ "Main.allSubsOfName: unexpected unqual'd name" diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs index a0b92fab..f22f9a2c 100644 --- a/src/Haddock/Interface/Rename.hs +++ b/src/Haddock/Interface/Rename.hs @@ -34,22 +34,22 @@ renameInterface renamingEnv mod = -- first create the local env, where every name exported by this module -- is mapped to itself, and everything else comes from the global renaming -- env - let localEnv = foldl fn renamingEnv (hmod_visible_exports mod) - where fn env name = Map.insert name (nameSetMod name (hmod_mod mod)) env + let localEnv = foldl fn renamingEnv (ifaceVisibleExports mod) + where fn env name = Map.insert name (nameSetMod name (ifaceMod mod)) env - docs = Map.toList (hmod_doc_map mod) + docs = Map.toList (ifaceDocMap mod) renameMapElem (k,d) = do d' <- renameDoc d; return (k, d') -- rename names in the exported declarations to point to things that -- are closer to, or maybe even exported by, the current module. (renamedExportItems, missingNames1) - = runRnFM localEnv (renameExportItems (hmod_export_items mod)) + = runRnFM localEnv (renameExportItems (ifaceExportItems mod)) (rnDocMap, missingNames2) = runRnFM localEnv (liftM Map.fromList (mapM renameMapElem docs)) (finalModuleDoc, missingNames3) - = runRnFM localEnv (renameMaybeDoc (hmod_doc mod)) + = runRnFM localEnv (renameMaybeDoc (ifaceDoc mod)) -- combine the missing names and filter out the built-ins, which would -- otherwise allways be missing. @@ -64,14 +64,14 @@ renameInterface renamingEnv mod = in do -- report things that we couldn't link to. Only do this for non-hidden -- modules. - when (OptHide `notElem` hmod_options mod && not (null strings)) $ - tell ["Warning: " ++ show (ppr (hmod_mod mod) defaultUserStyle) ++ + when (OptHide `notElem` ifaceOptions mod && not (null strings)) $ + tell ["Warning: " ++ show (ppr (ifaceMod mod) defaultUserStyle) ++ ": could not find link destinations for:\n"++ " " ++ concat (map (' ':) strings) ] - return $ mod { hmod_rn_doc = finalModuleDoc, - hmod_rn_doc_map = rnDocMap, - hmod_rn_export_items = renamedExportItems } + return $ mod { ifaceRnDoc = finalModuleDoc, + ifaceRnDocMap = rnDocMap, + ifaceRnExportItems = renamedExportItems } -------------------------------------------------------------------------------- -- cgit v1.2.3