summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-05-12 11:40:03 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-13 02:13:02 -0400
commite7272d53e67e72580caceae40e766c4bfeb1c398 (patch)
tree5e0d06cf3fc31e737ea385b53efe22e5916e847a /ghc
parentf6be6e432e53108075905c1fc7785d8b1f18a33f (diff)
downloadhaskell-e7272d53e67e72580caceae40e766c4bfeb1c398.tar.gz
Enhance UnitId use
* use UnitId instead of String to identify wired-in units * use UnitId instead of Unit in the backend (Unit are only use by Backpack to produce type-checked interfaces, not real code) * rename lookup functions for consistency * documentation
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 5630f32d7a..18976c2c88 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -57,8 +57,8 @@ import GHC.Driver.Types ( tyThingParent_maybe, handleFlagWarnings, getSafeMode,
hsc_dynLinker, hsc_interp )
import GHC.Unit.Module
import GHC.Types.Name
-import GHC.Unit.State ( unitIsTrusted, unsafeLookupUnit, getInstalledPackageDetails,
- listVisibleModuleNames, pprFlag )
+import GHC.Unit.State ( unitIsTrusted, unsafeLookupUnit, unsafeLookupUnitId,
+ listVisibleModuleNames, pprFlag )
import GHC.Iface.Syntax ( showToHeader )
import GHC.Core.Ppr.TyThing
import GHC.Builtin.Names
@@ -2364,7 +2364,7 @@ isSafeModule m = do
tallyPkgs dflags deps | not (packageTrustOn dflags) = (S.empty, S.empty)
| otherwise = S.partition part deps
- where part pkg = unitIsTrusted $ getInstalledPackageDetails pkgstate pkg
+ where part pkg = unitIsTrusted $ unsafeLookupUnitId pkgstate pkg
pkgstate = pkgState dflags
-----------------------------------------------------------------------------
@@ -4207,7 +4207,7 @@ lookupModuleName :: GHC.GhcMonad m => ModuleName -> m Module
lookupModuleName mName = GHC.lookupModule mName Nothing
isMainUnitModule :: Module -> Bool
-isMainUnitModule m = GHC.moduleUnit m == mainUnitId
+isMainUnitModule m = GHC.moduleUnit m == mainUnit
-- TODO: won't work if home dir is encoded.
-- (changeDirectory may not work either in that case.)