aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2009-01-08 18:03:36 +0000
committerDavid Waern <david.waern@gmail.com>2009-01-08 18:03:36 +0000
commit0a2b459e4582daa3070283a1b5e9a8cf10f147e1 (patch)
treebec424cc98c95b3335ba8f910fcdc5b606ab6147
parentb2eb5f3573d2f2eb836f5524ba1540f1d2da175f (diff)
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.
-rw-r--r--src/Haddock/Interface/Create.hs19
1 files changed, 15 insertions, 4 deletions
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