[project @ 2001-05-21 09:19:14 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcType.lhs
index 2cee03e..3f6831b 100644 (file)
@@ -23,7 +23,7 @@ module TcType (
   tcSplitRhoTy,
 
   tcInstTyVar, tcInstTyVars,
-  tcInstSigVar,
+  tcInstSigVars,
   tcInstType,
 
   --------------------------------
@@ -171,14 +171,14 @@ tcInstTyVar tyvar
     in
     tcNewMutTyVar name (tyVarKind tyvar)
 
-tcInstSigVar tyvar     -- Very similar to tcInstTyVar
-  = tcGetUnique        `thenNF_Tc` \ uniq ->
-    let 
-       name = setNameUnique (tyVarName tyvar) uniq
-       kind = tyVarKind tyvar
-    in
-    ASSERT( not (kind == openTypeKind) )       -- Shouldn't happen
-    tcNewSigTyVar name kind
+tcInstSigVars tyvars   -- Very similar to tcInstTyVar
+  = tcGetUniques       `thenNF_Tc` \ uniqs ->
+    listTc [ ASSERT( not (kind == openTypeKind) )      -- Shouldn't happen
+            tcNewSigTyVar name kind 
+          | (tyvar, uniq) <- tyvars `zip` uniqs,
+            let name = setNameUnique (tyVarName tyvar) uniq, 
+            let kind = tyVarKind tyvar
+          ]
 \end{code}
 
 @tcInstType@ instantiates the outer-level for-alls of a TcType with
@@ -188,8 +188,11 @@ fresh type variables, splits off the dictionary part, and returns the results.
 tcInstType :: TcType -> NF_TcM ([TcTyVar], TcThetaType, TcType)
 tcInstType ty
   = case splitForAllTys ty of
-       ([],     rho) -> tcSplitRhoTy rho                       `thenNF_Tc` \ (theta, tau) ->
+       ([],     rho) ->        -- There may be overloading but no type variables;
+                               --      (?x :: Int) => Int -> Int
+                        tcSplitRhoTy rho                       `thenNF_Tc` \ (theta, tau) ->
                         returnNF_Tc ([], theta, tau)
+
        (tyvars, rho) -> tcInstTyVars tyvars                    `thenNF_Tc` \ (tyvars', _, tenv)  ->
                         tcSplitRhoTy (substTy tenv rho)        `thenNF_Tc` \ (theta, tau) ->
                         returnNF_Tc (tyvars', theta, tau)