diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-04-29 12:36:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 12:36:37 -0400 |
commit | 66faa532d4e3d93e87c5b042bef82d631dc74eb5 (patch) | |
tree | 971e9594725d0c6c798161aaee22054b9c696356 /haddock-api/src/Haddock.hs | |
parent | 7c34f89d801bafba3162bc091dd486cbb9e9fd5b (diff) | |
parent | a61dbdb0a7420e15e978bce6c09de1ce99290f44 (diff) |
Merge pull request #1183 from hsyl20/wip/hsyl20/unitid
Refactoring of Unit code
Diffstat (limited to 'haddock-api/src/Haddock.hs')
-rw-r--r-- | haddock-api/src/Haddock.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 314458b2..85ccde3d 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -68,9 +68,8 @@ import GHC hiding (verbosity) import Config import GHC.Driver.Session hiding (projectVersion, verbosity) import GHC.Utils.Error -import GHC.Driver.Packages +import GHC.Unit import GHC.Utils.Panic (handleGhcException) -import GHC.Types.Module import GHC.Data.FastString import qualified GHC.Runtime.Loader @@ -294,8 +293,8 @@ render dflags flags sinceQual qual ifaces installedIfaces extSrcMap = do allVisibleIfaces = [ i | i <- allIfaces, OptHide `notElem` instOptions i ] pkgMod = fmap ifaceMod (listToMaybe ifaces) - pkgKey = fmap moduleUnitId pkgMod - pkgStr = fmap unitIdString pkgKey + pkgKey = fmap moduleUnit pkgMod + pkgStr = fmap unitString pkgKey pkgNameVer = modulePackageInfo dflags flags pkgMod pkgName = fmap (unpackFS . (\(PackageName n) -> n)) (fst pkgNameVer) sincePkg = case sinceQual of @@ -312,7 +311,7 @@ render dflags flags sinceQual qual ifaces installedIfaces extSrcMap = do (Map.map SrcExternal extSrcMap) (Map.fromList [ (ifaceMod iface, SrcLocal) | iface <- ifaces ]) - pkgSrcMap = Map.mapKeys moduleUnitId extSrcMap + pkgSrcMap = Map.mapKeys moduleUnit extSrcMap pkgSrcMap' | Flag_HyperlinkedSource `elem` flags , Just k <- pkgKey @@ -341,11 +340,11 @@ render dflags flags sinceQual qual ifaces installedIfaces extSrcMap = do -- records the *wired in* identity base. So untranslate it -- so that we can service the request. unwire :: Module -> Module - unwire m = m { moduleUnitId = unwireUnitId dflags (moduleUnitId m) } + unwire m = m { moduleUnit = unwireUnit dflags (moduleUnit m) } reexportedIfaces <- concat `fmap` (for (reexportFlags flags) $ \mod_str -> do let warn = hPutStrLn stderr . ("Warning: " ++) - case readP_to_S parseModuleId mod_str of + case readP_to_S parseHoleyModule mod_str of [(m, "")] | Just iface <- Map.lookup m installedMap -> return [iface] |