aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/ModuleTree.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2014-09-18 13:38:11 -0700
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-12-12 06:39:35 +0000
commit6e95f42907970c9cbb9f6279509a4bf5542ffae4 (patch)
treeb988e9b46bf3417aff4ed799befcf86d2d04d47e /haddock-api/src/Haddock/ModuleTree.hs
parent08332912f745dbd48c6e5fbf0c35e9828600b4db (diff)
Properly render package ID (not package key) in index, fixes #329.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Conflicts: haddock-api/src/Haddock/ModuleTree.hs
Diffstat (limited to 'haddock-api/src/Haddock/ModuleTree.hs')
-rw-r--r--haddock-api/src/Haddock/ModuleTree.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/haddock-api/src/Haddock/ModuleTree.hs b/haddock-api/src/Haddock/ModuleTree.hs
index 662d7025..eec1342e 100644
--- a/haddock-api/src/Haddock/ModuleTree.hs
+++ b/haddock-api/src/Haddock/ModuleTree.hs
@@ -15,18 +15,21 @@ module Haddock.ModuleTree ( ModuleTree(..), mkModuleTree ) where
import Haddock.Types ( MDoc )
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 (MDoc Name)) [ModuleTree]
-mkModuleTree :: Bool -> [(Module, Maybe (MDoc Name))] -> [ModuleTree]
-mkModuleTree showPkgs mods =
+mkModuleTree :: DynFlags -> Bool -> [(Module, Maybe (MDoc 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