From 0a2b459e4582daa3070283a1b5e9a8cf10f147e1 Mon Sep 17 00:00:00 2001 From: David Waern Date: Thu, 8 Jan 2009 18:03:36 +0000 Subject: Export modules also when coming from external packages This seems to have regressed since a refactoring that was part of the 2.3.0 release. --- src/Haddock/Interface/Create.hs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index 7a958504..a4738b54 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -359,7 +359,6 @@ mkExportItems modMap this_mod exported_names decls declMap everything_local_exported = -- everything exported return (fullContentsOfThisModule this_mod decls) - packageId = modulePackageId this_mod lookupExport (IEVar x) = declWith x lookupExport (IEThingAbs t) = declWith t @@ -371,7 +370,7 @@ mkExportItems modMap this_mod exported_names decls declMap lookupExport (IEThingAll t) = declWith t lookupExport (IEThingWith t cs) = declWith t - lookupExport (IEModuleContents m) = fullContentsOf (mkModule packageId m) + lookupExport (IEModuleContents m) = fullContentsOf m lookupExport (IEGroup lev doc) = return [ ExportGroup lev "" doc ] lookupExport (IEDoc doc) = return [ ExportDoc doc ] lookupExport (IEDocNamed str) = do @@ -407,7 +406,7 @@ mkExportItems modMap this_mod exported_names decls declMap subs' = filter ((`elem` exported_names) . fst) subs sub_names = map fst subs' - fullContentsOf m + fullContentsOf modname | m == this_mod = return (fullContentsOfThisModule this_mod decls) | otherwise = case Map.lookup m modMap of @@ -415,8 +414,20 @@ mkExportItems modMap this_mod exported_names decls declMap | OptHide `elem` ifaceOptions iface -> return (ifaceExportItems iface) | otherwise -> return [ ExportModule m ] - Nothing -> return [] -- already emitted a warning in visibleNames + + Nothing -> -- we have to try to find it in the installed interfaces + -- (external packages) + case Map.lookup modname (Map.mapKeys moduleName instIfaceMap) of + Just iface -> return [ ExportModule (instMod iface) ] + Nothing -> do + tell ["Warning: " ++ pretty this_mod ++ ": Could not find " ++ + "documentation for exported module: " ++ pretty modname] + return [] + where + m = mkModule packageId modname + packageId = modulePackageId this_mod + findDecl :: Name -> Maybe DeclInfo findDecl n | m == this_mod = Map.lookup n declMap -- cgit v1.2.3