diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-06-09 12:09:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 12:09:58 -0400 |
commit | e2a7f9dcebc7c48f7e8fccef8643ed0928a91753 (patch) | |
tree | ce7379891e838a4e912f55d6ba886e8f504fcad3 /haddock-api/src/Haddock/ModuleTree.hs | |
parent | c849a39a6996221541a47a46a8b8826977ed8a5c (diff) | |
parent | 760cd58cfafe1ff25fcceed88ad2c824f10f6d6b (diff) |
Merge pull request #1202 from hsyl20/wip/hsyl20/unitid-ii
Fix after unit refactoring
Diffstat (limited to 'haddock-api/src/Haddock/ModuleTree.hs')
-rw-r--r-- | haddock-api/src/Haddock/ModuleTree.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/haddock-api/src/Haddock/ModuleTree.hs b/haddock-api/src/Haddock/ModuleTree.hs index 688e3e71..d0a39322 100644 --- a/haddock-api/src/Haddock/ModuleTree.hs +++ b/haddock-api/src/Haddock/ModuleTree.hs @@ -14,10 +14,9 @@ module Haddock.ModuleTree ( ModuleTree(..), mkModuleTree ) where import Haddock.Types ( MDoc ) -import GHC ( Name ) -import GHC.Unit.Module ( Module, moduleNameString, moduleName, moduleUnit, unitString ) -import GHC.Driver.Session ( DynFlags ) -import GHC.Unit.State ( lookupUnit, unitPackageIdString ) +import GHC ( Name ) +import GHC.Unit.Module ( Module, moduleNameString, moduleName, moduleUnit, unitString ) +import GHC.Unit.State ( UnitState, lookupUnit, unitPackageIdString ) import qualified Control.Applicative as A @@ -25,14 +24,14 @@ import qualified Control.Applicative as A data ModuleTree = Node String (Maybe Module) (Maybe String) (Maybe String) (Maybe (MDoc Name)) [ModuleTree] -mkModuleTree :: DynFlags -> Bool -> [(Module, Maybe (MDoc Name))] -> [ModuleTree] -mkModuleTree dflags showPkgs mods = +mkModuleTree :: UnitState -> Bool -> [(Module, Maybe (MDoc Name))] -> [ModuleTree] +mkModuleTree state showPkgs mods = foldr fn [] [ (mdl, splitModule mdl, modPkg mdl, modSrcPkg mdl, short) | (mdl, short) <- mods ] where modPkg mod_ | showPkgs = Just (unitString (moduleUnit mod_)) | otherwise = Nothing modSrcPkg mod_ | showPkgs = fmap unitPackageIdString - (lookupUnit dflags (moduleUnit mod_)) + (lookupUnit state (moduleUnit mod_)) | otherwise = Nothing fn (m,mod_,pkg,srcPkg,short) = addToTrees mod_ m pkg srcPkg short |