Use names like '$fOrdInt' for dfuns (and TF instances), rather than '$f21'
[ghc-hetmet.git] / compiler / typecheck / TcRnTypes.lhs
index 28bfd8e..19432fa 100644 (file)
@@ -34,7 +34,7 @@ module TcRnTypes(
        plusLIEs, mkLIE, isEmptyLIE, lieToList, listToLIE,
 
        -- Misc other types
-       TcId, TcIdSet, TcDictBinds,
+       TcId, TcIdSet, TcDictBinds, TcTyVarBind(..), TcTyVarBinds
        
   ) where
 
@@ -68,8 +68,7 @@ import Outputable
 import ListSetOps
 import FastString
 
-import Data.Maybe
-import Data.List
+import Data.Set (Set)
 \end{code}
 
 
@@ -98,6 +97,18 @@ type RnM  a = TcRn a         -- Historical
 type TcM  a = TcRn a           -- Historical
 \end{code}
 
+Representation of type bindings to uninstantiated meta variables used during
+constraint solving.
+
+\begin{code}
+data TcTyVarBind = TcTyVarBind TcTyVar TcType
+
+type TcTyVarBinds = Bag TcTyVarBind
+
+instance Outputable TcTyVarBind where
+  ppr (TcTyVarBind tv ty) = ppr tv <+> text ":=" <+> ppr ty
+\end{code}
+
 
 %************************************************************************
 %*                                                                     *
@@ -211,21 +222,18 @@ data TcGblEnv
           -- reference is implicit rather than explicit, so we have to zap a
           -- mutable variable.
 
-       tcg_dfun_n  :: TcRef Int,
-          -- ^ Allows us to number off the names of DFuns.
-          --
-          -- It's convenient to allocate an External Name for a DFun, with
-          -- a permanently-fixed unique, just like other top-level functions
-          -- defined in this module.  But that means we need a canonical
-          -- occurrence name, distinct from all other dfuns in this module,
-          -- and this name supply serves that purpose (df1, df2, etc).
+       tcg_dfun_n  :: TcRef OccSet,
+          -- ^ Allows us to choose unique DFun names.
 
        -- The next fields accumulate the payload of the module
        -- The binds, rules and foreign-decl fiels are collected
        -- initially in un-zonked form and are finally zonked in tcRnSrcDecls
 
-        tcg_rn_imports :: Maybe [LImportDecl Name],
         tcg_rn_exports :: Maybe [Located (IE Name)],
+        tcg_rn_imports :: [LImportDecl Name],
+               -- Keep the renamed imports regardless.  They are not 
+               -- voluminous and are needed if you want to report unused imports
+        tcg_used_rdrnames :: TcRef (Set RdrName),
        tcg_rn_decls :: Maybe (HsGroup Name),
           -- ^ Renamed decls, maybe.  @Nothing@ <=> Don't retain renamed
           -- decls.
@@ -343,15 +351,20 @@ data TcLclEnv             -- Changes as we move inside an expression
                -- We still need the unsullied global name env so that
                --   we can look up record field names
 
-       tcl_env  :: NameEnv TcTyThing,  -- The local type environment: Ids and TyVars
-                                       -- defined in this module
+       tcl_env  :: NameEnv TcTyThing,  -- The local type environment: Ids and
+                                       -- TyVars defined in this module
                                        
        tcl_tyvars :: TcRef TcTyVarSet, -- The "global tyvars"
                        -- Namely, the in-scope TyVars bound in tcl_env, 
-                       -- plus the tyvars mentioned in the types of Ids bound in tcl_lenv
-                       -- Why mutable? see notes with tcGetGlobalTyVars
+                       -- plus the tyvars mentioned in the types of Ids bound
+                       -- in tcl_lenv. 
+                        -- Why mutable? see notes with tcGetGlobalTyVars
+
+       tcl_lie   :: TcRef LIE,         -- Place to accumulate type constraints
 
-       tcl_lie   :: TcRef LIE          -- Place to accumulate type constraints
+        tcl_tybinds :: TcRef TcTyVarBinds -- Meta and coercion type variable
+                                          -- bindings accumulated during
+                                          -- constraint solving
     }