+ where delVarSetListByKey = foldl' delVarSetByKey
+
+ tidyTermTyVars :: Session -> Term -> IO Term
+ tidyTermTyVars (Session ref) t = do
+ hsc_env <- readIORef ref
+ let env_tvs = ic_tyvars (hsc_IC hsc_env)
+ my_tvs = termTyVars t
+ tvs = env_tvs `minusVarSet` my_tvs
+ tyvarOccName = nameOccName . tyVarName
+ tidyEnv = (initTidyOccEnv (map tyvarOccName (varSetElems tvs))
+ , env_tvs `intersectVarSet` my_tvs)
+ return$ mapTermType (snd . tidyOpenType tidyEnv) t
+