summaryrefslogtreecommitdiff
path: root/compiler/main/Packages.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-02-01 14:31:49 +0100
committerBen Gamari <ben@smart-cactus.org>2016-02-01 14:32:15 +0100
commit0d601657ca6ec1812492bb16a7d0e181b370e2d8 (patch)
tree8bd06a98672c26f1a3d5104fd5c610df1643a2ac /compiler/main/Packages.hs
parente5a0a8903715b8717342dabeb72d69b4d5e61e5c (diff)
downloadhaskell-0d601657ca6ec1812492bb16a7d0e181b370e2d8.tar.gz
Simplify ghc-boot database representation with new type class.
Previously, we had an 'OriginalModule' type in ghc-boot which was basically identical to 'Module', and we had to do a bit of gyrating to get it converted into the right form. This commit introduces a new typeclass, 'DbModuleRep' which represents types which we know how to serialize to and from the (now renamed) 'DbModule' type. The upshot is that we can just store 'Module's DIRECTLY in the 'InstalledPackageInfo', no conversion needed. I took the opportunity to clean up ghc-pkg to make its use of the 'BinaryStringRep' classes more type safe. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1811
Diffstat (limited to 'compiler/main/Packages.hs')
-rw-r--r--compiler/main/Packages.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index 0a8b279374..3c646a5a5d 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -768,8 +768,12 @@ findWiredInPackages dflags pkgs vis_map = do
| otherwise
= pkg
upd_deps pkg = pkg {
- depends = map upd_wired_in (depends pkg)
+ depends = map upd_wired_in (depends pkg),
+ exposedModules
+ = map (\(k,v) -> (k, fmap upd_wired_in_mod v))
+ (exposedModules pkg)
}
+ upd_wired_in_mod (Module uid m) = Module (upd_wired_in uid) m
upd_wired_in key
| Just key' <- Map.lookup key wiredInMap = key'
| otherwise = key
@@ -1155,11 +1159,11 @@ mkModuleToPkgConfAll dflags pkg_db vis_map =
es :: Bool -> [(ModuleName, Map Module ModuleOrigin)]
es e = do
- ExposedModule m exposedReexport <- exposed_mods
+ (m, exposedReexport) <- exposed_mods
let (pk', m', pkg', origin') =
case exposedReexport of
Nothing -> (pk, m, pkg, fromExposedModules e)
- Just (OriginalModule pk' m') ->
+ Just (Module pk' m') ->
let pkg' = pkg_lookup pk'
in (pk', m', pkg', fromReexportedModules e pkg')
return (m, sing pk' m' pkg' origin')