+%
+% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
+%
+\section[TcType]{Types used in the typechecker}
+
\begin{code}
module TcType (
-- friends:
-import Type ( Type, ThetaType, GenType(..), mkAppTy,
- tyVarsOfTypes, getTyVar_maybe, splitDictTy_maybe,
- splitForAllTys, splitRhoTy, isTyVarTy,
- mkForAllTys, instantiateTy
- )
-import TyVar ( TyVar, GenTyVar(..), TyVarSet, GenTyVarSet,
- TyVarEnv, lookupTyVarEnv, addToTyVarEnv,
- emptyTyVarEnv, mkTyVarEnv, zipTyVarEnv,
- tyVarSetToList
- )
+import Type ( Type, ThetaType, GenType(..), mkAppTy,
+ tyVarsOfTypes, splitDictTy_maybe,
+ isTyVarTy, instantiateTy
+ )
+import TyVar ( TyVar, GenTyVar(..), GenTyVarSet,
+ TyVarEnv, lookupTyVarEnv, addToTyVarEnv,
+ emptyTyVarEnv, zipTyVarEnv, tyVarSetToList
+ )
-- others:
-import Class ( Class )
-import TyCon ( isFunTyCon )
-import Kind ( Kind )
-import TcKind ( TcKind )
+import Class ( Class )
+import TyCon ( isFunTyCon )
+import Kind ( Kind )
import TcMonad
+import Name ( changeUnique )
import TysPrim ( voidTy )
-import Name ( NamedThing(..) )
import Unique ( Unique )
import UniqFM ( UniqFM )
-import Maybes ( assocMaybe )
import BasicTypes ( unused )
-import Util ( zipEqual, nOfThem )
-import Outputable
+import Util ( nOfThem, panic )
\end{code}
tcNewMutVar UnBound `thenNF_Tc` \ box ->
-- Was DontBind, but we've nuked that "optimisation"
+ let
+ name' = case name of
+ Nothing -> Nothing
+ Just n -> Just (changeUnique n uniq)
+ in
- returnNF_Tc (TyVar uniq kind name box)
+ returnNF_Tc (TyVar uniq kind name' box)
-- We propagate the name of the sigature type variable
\end{code}
where
bind_fn = inst_sig_tyvar -- Note: inst_sig_tyvar, not inst_tyvar
-- I don't think that can lead to strange error messages
+ -- of the form can't match (T a) against (T a)
+ -- See notes with inst_tyvar
+
occ_fn env tyvar = case lookupTyVarEnv env tyvar of
Just ty -> returnNF_Tc ty
Nothing -> panic "tcInstType:2"-- (vcat [ppr ty_to_inst,