summaryrefslogtreecommitdiff
path: root/compiler/GHC/Runtime/Context.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Runtime/Context.hs')
-rw-r--r--compiler/GHC/Runtime/Context.hs15
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/GHC/Runtime/Context.hs b/compiler/GHC/Runtime/Context.hs
index 8222e96ce8..3ea5f2725c 100644
--- a/compiler/GHC/Runtime/Context.hs
+++ b/compiler/GHC/Runtime/Context.hs
@@ -27,7 +27,7 @@ import GHC.Unit
import GHC.Unit.Env
import GHC.Core.FamInstEnv
-import GHC.Core.InstEnv ( ClsInst, identicalClsInstHead )
+import GHC.Core.InstEnv
import GHC.Core.Type
import GHC.Types.Avail
@@ -43,7 +43,6 @@ import GHC.Types.Var
import GHC.Builtin.Names ( ioTyConName, printName, mkInteractiveModule )
import GHC.Utils.Outputable
-import GHC.Utils.Misc
{-
Note [The interactive package]
@@ -257,7 +256,7 @@ data InteractiveContext
-- recalculation when the set of imports change.
-- See Note [icReaderEnv recalculation]
- ic_instances :: ([ClsInst], [FamInst]),
+ ic_instances :: (InstEnv, [FamInst]),
-- ^ All instances and family instances created during
-- this session. These are grabbed en masse after each
-- update to be sure that proper overlapping is retained.
@@ -314,7 +313,7 @@ emptyInteractiveContext dflags
ic_gre_cache = emptyIcGlobalRdrEnv,
ic_mod_index = 1,
ic_tythings = [],
- ic_instances = ([],[]),
+ ic_instances = (emptyInstEnv,[]),
ic_fix_env = emptyNameEnv,
ic_monad = ioTyConName, -- IO monad by default
ic_int_print = printName, -- System.IO.print by default
@@ -360,7 +359,7 @@ icPrintUnqual unit_env ictxt = mkPrintUnqualified unit_env (icReaderEnv ictxt)
-- still keeping the old names in scope in their qualified form (Ghci1.foo).
extendInteractiveContext :: InteractiveContext
-> [TyThing]
- -> [ClsInst] -> [FamInst]
+ -> InstEnv -> [FamInst]
-> Maybe [Type]
-> FixityEnv
-> InteractiveContext
@@ -369,8 +368,8 @@ extendInteractiveContext ictxt new_tythings new_cls_insts new_fam_insts defaults
-- Always bump this; even instances should create
-- a new mod_index (#9426)
, ic_tythings = new_tythings ++ ic_tythings ictxt
- , ic_gre_cache = ic_gre_cache ictxt `icExtendIcGblRdrEnv` new_tythings
- , ic_instances = ( new_cls_insts ++ old_cls_insts
+ , ic_gre_cache = ic_gre_cache ictxt `icExtendIcGblRdrEnv` new_tythings
+ , ic_instances = ( new_cls_insts `unionInstEnv` old_cls_insts
, new_fam_insts ++ fam_insts )
-- we don't shadow old family instances (#7102),
-- so don't need to remove them here
@@ -381,7 +380,7 @@ extendInteractiveContext ictxt new_tythings new_cls_insts new_fam_insts defaults
-- Discard old instances that have been fully overridden
-- See Note [Override identical instances in GHCi]
(cls_insts, fam_insts) = ic_instances ictxt
- old_cls_insts = filterOut (\i -> any (identicalClsInstHead i) new_cls_insts) cls_insts
+ old_cls_insts = filterInstEnv (\i -> not $ anyInstEnv (identicalClsInstHead i) new_cls_insts) cls_insts
extendInteractiveContextWithIds :: InteractiveContext -> [Id] -> InteractiveContext
-- Just a specialised version