summaryrefslogtreecommitdiff
path: root/compiler/iface/IfaceEnv.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/iface/IfaceEnv.hs')
-rw-r--r--compiler/iface/IfaceEnv.hs25
1 files changed, 22 insertions, 3 deletions
diff --git a/compiler/iface/IfaceEnv.hs b/compiler/iface/IfaceEnv.hs
index 645ceda5c0..43094f94aa 100644
--- a/compiler/iface/IfaceEnv.hs
+++ b/compiler/iface/IfaceEnv.hs
@@ -9,7 +9,8 @@ module IfaceEnv (
lookupOrig, lookupOrigNameCache, extendNameCache,
newIfaceName, newIfaceNames,
extendIfaceIdEnv, extendIfaceTyVarEnv,
- tcIfaceLclId, tcIfaceTyVar, lookupIfaceTyVar,
+ tcIfaceLclId, tcIfaceTyVar, lookupIfaceVar,
+ lookupIfaceTyVar, extendIfaceEnvs,
ifaceExportNames,
@@ -31,11 +32,13 @@ import Avail
import Module
import UniqFM
import FastString
+import IfaceType
import UniqSupply
import SrcLoc
import Util
import Outputable
+import Data.List ( partition )
{-
*********************************************************
@@ -277,8 +280,16 @@ tcIfaceTyVar occ
Nothing -> failIfM (text "Iface type variable out of scope: " <+> ppr occ)
}
-lookupIfaceTyVar :: FastString -> IfL (Maybe TyVar)
-lookupIfaceTyVar occ
+lookupIfaceTyVar :: IfaceTvBndr -> IfL (Maybe TyVar)
+lookupIfaceTyVar (occ, _)
+ = do { lcl <- getLclEnv
+ ; return (lookupUFM (if_tv_env lcl) occ) }
+
+lookupIfaceVar :: IfaceBndr -> IfL (Maybe TyCoVar)
+lookupIfaceVar (IfaceIdBndr (occ, _))
+ = do { lcl <- getLclEnv
+ ; return (lookupUFM (if_id_env lcl) occ) }
+lookupIfaceVar (IfaceTvBndr (occ, _))
= do { lcl <- getLclEnv
; return (lookupUFM (if_tv_env lcl) occ) }
@@ -289,6 +300,14 @@ extendIfaceTyVarEnv tyvars thing_inside
; pairs = [(occNameFS (getOccName tv), tv) | tv <- tyvars] }
; setLclEnv (env { if_tv_env = tv_env' }) thing_inside }
+extendIfaceEnvs :: [TyCoVar] -> IfL a -> IfL a
+extendIfaceEnvs tcvs thing_inside
+ = extendIfaceTyVarEnv tvs $
+ extendIfaceIdEnv cvs $
+ thing_inside
+ where
+ (tvs, cvs) = partition isTyVar tcvs
+
{-
************************************************************************
* *