From e7272d53e67e72580caceae40e766c4bfeb1c398 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Tue, 12 May 2020 11:40:03 +0200 Subject: 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 --- ghc/GHCi/UI.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ghc') 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.) -- cgit v1.2.1