- applySubstToEnv :: Session -> TvSubst -> IO ()
- applySubstToEnv cms subst | isEmptyTvSubst subst = return ()
- applySubstToEnv cms@(Session ref) subst = do
- hsc_env <- readIORef ref
- inScope <- GHC.getBindings cms
- let ictxt = hsc_IC hsc_env
- type_env = ic_type_env ictxt
- ids = typeEnvIds type_env
- ids' = map (\id -> id `setIdType` substTy subst (idType id)) ids
- type_env'= extendTypeEnvWithIds type_env ids'
- subst_dom= varEnvKeys$ getTvSubstEnv subst
- ictxt' = ictxt { ic_type_env = type_env'
- , ic_tyvars = foldl' delVarSetByKey
- (ic_tyvars ictxt)
- subst_dom }
- writeIORef ref (hsc_env {hsc_IC = ictxt'})
-