aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/ModuleTree.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2014-09-18 13:38:11 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-09-18 13:38:11 -0700
commitee47a1ab37699db0573c9cf0aa6461e1f8865197 (patch)
tree9eb0ca0d12911663b01d1f1c7ac82752fe9011ed /src/Haddock/ModuleTree.hs
parent4023817d7c0e46db012ba2eea28022626841ca9b (diff)
Properly render package ID (not package key) in index, fixes #329.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'src/Haddock/ModuleTree.hs')
-rw-r--r--src/Haddock/ModuleTree.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Haddock/ModuleTree.hs b/src/Haddock/ModuleTree.hs
index 28c5c06d..cb926685 100644
--- a/src/Haddock/ModuleTree.hs
+++ b/src/Haddock/ModuleTree.hs
@@ -15,18 +15,21 @@ module Haddock.ModuleTree ( ModuleTree(..), mkModuleTree ) where
import Haddock.Types ( Doc )
import GHC ( Name )
-import Module ( Module, moduleNameString, moduleName, modulePackageKey,
- packageKeyString )
+import Module ( Module, moduleNameString, moduleName, modulePackageKey )
+import DynFlags ( DynFlags )
+import Packages ( lookupPackage )
+import PackageConfig ( sourcePackageIdString )
data ModuleTree = Node String Bool (Maybe String) (Maybe (Doc Name)) [ModuleTree]
-mkModuleTree :: Bool -> [(Module, Maybe (Doc Name))] -> [ModuleTree]
-mkModuleTree showPkgs mods =
+mkModuleTree :: DynFlags -> Bool -> [(Module, Maybe (Doc Name))] -> [ModuleTree]
+mkModuleTree dflags showPkgs mods =
foldr fn [] [ (splitModule mdl, modPkg mdl, short) | (mdl, short) <- mods ]
where
- modPkg mod_ | showPkgs = Just (packageKeyString (modulePackageKey mod_))
+ modPkg mod_ | showPkgs = fmap sourcePackageIdString
+ (lookupPackage dflags (modulePackageKey mod_))
| otherwise = Nothing
fn (mod_,pkg,short) = addToTrees mod_ pkg short