[project @ 2001-10-17 15:39:08 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcEnv.lhs
index cbc20ff..9b281ed 100644 (file)
@@ -16,7 +16,7 @@ module TcEnv(
        -- Global environment
        tcExtendGlobalEnv, tcExtendGlobalValEnv, tcExtendGlobalTypeEnv,
        tcLookupTyCon, tcLookupClass, tcLookupGlobalId, tcLookupDataCon,
-       tcLookupGlobal_maybe, tcLookupGlobal, tcLookupSyntaxId, tcLookupSyntaxName,
+       tcLookupGlobal_maybe, tcLookupGlobal, 
 
        -- Local environment
        tcExtendKindEnv,  tcLookupLocalIds, tcInLocalScope,
@@ -41,17 +41,15 @@ module TcEnv(
 
 import RnHsSyn         ( RenamedMonoBinds, RenamedSig )
 import TcMonad
-import TcType          ( TcKind,  TcType, TcTyVar, TcTyVarSet, 
-                         zonkTcTyVarsAndFV
+import TcMType         ( zonkTcTyVarsAndFV )
+import TcType          ( Type, ThetaType, 
+                         tyVarsOfTypes, tcSplitDFunTy,
+                         getDFunTyKey, tcTyConAppTyCon
                        )
 import Id              ( idName, mkSpecPragmaId, mkUserLocal, isDataConWrapId_maybe )
 import IdInfo          ( vanillaIdInfo )
 import Var             ( TyVar, Id, idType, lazySetIdInfo, idInfo )
 import VarSet
-import Type            ( Type, ThetaType, 
-                         tyVarsOfTypes, splitDFunTy,
-                         getDFunTyKey, tyConAppTyCon
-                       )
 import DataCon         ( DataCon )
 import TyCon           ( TyCon )
 import Class           ( Class, ClassOpItem )
@@ -73,7 +71,6 @@ import InstEnv                ( InstEnv, emptyInstEnv )
 import HscTypes                ( lookupType, TyThing(..) )
 import Util            ( zipEqual )
 import SrcLoc          ( SrcLoc )
-import qualified PrelNames 
 import Outputable
 
 import IOExts          ( newIORef )
@@ -91,8 +88,6 @@ type TcIdSet = IdSet
 
 data TcEnv
   = TcEnv {
-       tcSyntaxMap :: PrelNames.SyntaxMap,     -- The syntax map (usually the identity)
-
        tcGST    :: Name -> Maybe TyThing,      -- The type environment at the moment we began this compilation
 
        tcInsts  :: InstEnv,            -- All instances (both imported and in this module)
@@ -147,11 +142,10 @@ data TcTyThing
 --     3. Then we zonk the kind variable.
 --     4. Now we know the kind for 'a', and we add (a -> ATyVar a::K) to the environment
 
-initTcEnv :: PrelNames.SyntaxMap -> HomeSymbolTable -> PackageTypeEnv -> IO TcEnv
-initTcEnv syntax_map hst pte 
+initTcEnv :: HomeSymbolTable -> PackageTypeEnv -> IO TcEnv
+initTcEnv hst pte 
   = do { gtv_var <- newIORef emptyVarSet ;
-        return (TcEnv { tcSyntaxMap = syntax_map,
-                        tcGST    = lookup,
+        return (TcEnv { tcGST    = lookup,
                         tcGEnv   = emptyNameEnv,
                         tcInsts  = emptyInstEnv,
                         tcLEnv   = emptyNameEnv,
@@ -370,21 +364,6 @@ tcLookupLocalIds ns
     lookup lenv name = case lookupNameEnv lenv name of
                        Just (ATcId id) -> id
                        other           -> pprPanic "tcLookupLocalIds" (ppr name)
-
-tcLookupSyntaxId :: Name -> NF_TcM Id
--- Lookup a name like PrelNum.fromInt, and return the corresponding Id,
--- after mapping through the SyntaxMap.  This may give us the Id for
--- (say) MyPrelude.fromInteger
-tcLookupSyntaxId name
-  = tcGetEnv           `thenNF_Tc` \ env ->
-    returnNF_Tc (case lookup_global env (tcSyntaxMap env name) of
-                       Just (AnId id) -> id
-                       other          -> pprPanic "tcLookupSyntaxId" (ppr name))
-
-tcLookupSyntaxName :: Name -> NF_TcM Name
-tcLookupSyntaxName name
-  = tcGetEnv           `thenNF_Tc` \ env ->
-    returnNF_Tc (tcSyntaxMap env name)
 \end{code}
 
 
@@ -541,13 +520,13 @@ pprInstInfo info = vcat [ptext SLIT("InstInfo:") <+> ppr (idType (iDFunId info))
                         nest 4 (ppr (iBinds info))]
 
 simpleInstInfoTy :: InstInfo -> Type
-simpleInstInfoTy info = case splitDFunTy (idType (iDFunId info)) of
+simpleInstInfoTy info = case tcSplitDFunTy (idType (iDFunId info)) of
                          (_, _, _, [ty]) -> ty
 
 simpleInstInfoTyCon :: InstInfo -> TyCon
   -- Gets the type constructor for a simple instance declaration,
   -- i.e. one of the form      instance (...) => C (T a b c) where ...
-simpleInstInfoTyCon inst = tyConAppTyCon (simpleInstInfoTy inst)
+simpleInstInfoTyCon inst = tcTyConAppTyCon (simpleInstInfoTy inst)
 \end{code}