aboutsummaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2008-11-15 22:59:33 +0000
committerDavid Waern <david.waern@gmail.com>2008-11-15 22:59:33 +0000
commit41fbe99fb430b4de1ec7aac30a67e8023821f449 (patch)
tree2109c31dd127868532d4676b97d680fdb8097817 /src/Main.hs
parentca24f467c6aeaa56bcdc04cc3f58eadc1abf93ba (diff)
Store hidden modules in .haddock files
We store documentation for an entity in the 'InstalledInterface' of the definition site module, and never in the same structure for a module which re-exports the entity. So when a client of the Haddock library wants to look up some documentation, he/she might need to access a hidden module. But we currently don't store hidden modules in the .haddock files. So we add the hidden modules and the Haddock options to the .haddock files. The options will be used to filter the module list to obtain the visible modules only, which is necessary for generating the contents and index for installed packages.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 902faed6..8f3895bd 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -172,14 +172,12 @@ main = handleTopExceptions $ do
-- create the interfaces -- this is the core part of Haddock
(interfaces, homeLinks) <- createInterfaces fileArgs extLinks flags
- let visibleIfaces = [ i | i <- interfaces, OptHide `notElem` ifaceOptions i ]
-
liftIO $ do
-- render the interfaces
- renderStep packages visibleIfaces
+ renderStep packages interfaces
-- last but not least, dump the interface file
- dumpInterfaceFile (map toInstalledIface visibleIfaces) homeLinks flags
+ dumpInterfaceFile (map toInstalledIface interfaces) homeLinks flags
#else
-- initialize GHC
(session, dynflags) <- startGhc libDir (ghcFlags flags)
@@ -193,13 +191,11 @@ main = handleTopExceptions $ do
-- create the interfaces -- this is the core part of Haddock
(interfaces, homeLinks) <- createInterfaces session fileArgs extLinks flags
- let visibleIfaces = [ i | i <- interfaces, OptHide `notElem` ifaceOptions i ]
-
-- render the interfaces
- renderStep packages visibleIfaces
+ renderStep packages interfaces
-- last but not least, dump the interface file
- dumpInterfaceFile (map toInstalledIface visibleIfaces) homeLinks flags
+ dumpInterfaceFile (map toInstalledIface interfaces) homeLinks flags
#endif
else do
-- get packages supplied with --read-interface
@@ -216,7 +212,7 @@ main = handleTopExceptions $ do
-- | Render the interfaces with whatever backend is specified in the flags
render :: [Flag] -> [Interface] -> [InstalledInterface] -> IO ()
-render flags visibleIfaces installedIfaces = do
+render flags ifaces installedIfaces = do
let
title = case [str | Flag_Heading str <- flags] of
[] -> ""
@@ -271,11 +267,13 @@ render flags visibleIfaces installedIfaces = do
prologue <- getPrologue flags
let
+ visibleIfaces = [ i | i <- ifaces, OptHide `notElem` ifaceOptions i ]
+
-- *all* visible interfaces including external package modules
- allVisibleIfaces = map toInstalledIface visibleIfaces
- ++ installedIfaces
-
- packageMod = ifaceMod (head visibleIfaces)
+ allIfaces = map toInstalledIface ifaces ++ installedIfaces
+ allVisibleIfaces = [ i | i <- allIfaces, OptHide `notElem` instOptions i ]
+
+ packageMod = ifaceMod (head ifaces)
packageStr = Just (modulePackageString packageMod)
(pkgName,pkgVer) = modulePackageInfo packageMod
@@ -305,6 +303,7 @@ render flags visibleIfaces installedIfaces = do
when (Flag_Hoogle `elem` flags) $ do
ppHoogle pkgName pkgVer title prologue visibleIfaces odir
+
-------------------------------------------------------------------------------
-- Reading and dumping interface files
-------------------------------------------------------------------------------