[project @ 2000-07-14 13:37:53 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcInstDcls.lhs
index a140b9c..fd2b5dd 100644 (file)
@@ -28,9 +28,9 @@ import TcEnv          ( ValueEnv, tcExtendGlobalValEnv, tcExtendTyVarEnvForMeths,
                          tcAddImportedIdInfo, tcInstId
                        )
 import TcInstUtil      ( InstInfo(..), classDataCon )
-import TcMonoType      ( tcHsTopType )
+import TcMonoType      ( tcHsSigType )
 import TcSimplify      ( tcSimplifyAndCheck )
-import TcType          ( TcTyVar, zonkTcTyVarBndr )
+import TcType          ( TcTyVar, zonkTcSigTyVars )
 
 import Bag             ( emptyBag, unitBag, unionBags, unionManyBags,
                          foldBag, Bag
@@ -38,7 +38,6 @@ import Bag            ( emptyBag, unitBag, unionBags, unionManyBags,
 import CmdLineOpts     ( opt_GlasgowExts, opt_AllowUndecidableInstances )
 import Class           ( classBigSig, Class )
 import Var             ( idName, idType, Id, TyVar )
-import DataCon         ( isNullaryDataCon, splitProductType_maybe )
 import Maybes          ( maybeToBool, catMaybes, expectJust )
 import MkId            ( mkDictFunId )
 import Module          ( ModuleName )
@@ -46,7 +45,6 @@ import Name           ( isLocallyDefined, NamedThing(..)      )
 import NameSet         ( emptyNameSet )
 import PrelInfo                ( eRROR_ID )
 import PprType         ( pprConstraint )
-import SrcLoc          ( SrcLoc )
 import TyCon           ( isSynTyCon, tyConDerivings )
 import Type            ( Type, isUnLiftedType, mkTyVarTys,
                          splitSigmaTy, isTyVarTy,
@@ -57,7 +55,6 @@ import Type           ( Type, isUnLiftedType, mkTyVarTys,
                        )
 import Subst           ( mkTopTyVarSubst, substClasses )
 import VarSet          ( mkVarSet, varSetElems )
-import TysPrim         ( byteArrayPrimTyCon, mutableByteArrayPrimTyCon )
 import TysWiredIn      ( stringTy, isFFIArgumentTy, isFFIResultTy )
 import Unique          ( Unique, cCallableClassKey, cReturnableClassKey, hasKey, Uniquable(..) )
 import Outputable
@@ -172,7 +169,7 @@ tcInstDecl1 unf_env (InstDecl poly_ty binds uprags dfun_name src_loc)
     tcAddSrcLoc src_loc                        $
 
        -- Type-check all the stuff before the "where"
-    tcHsTopType poly_ty                        `thenTc` \ poly_ty' ->
+    tcHsSigType poly_ty                        `thenTc` \ poly_ty' ->
     let
        (tyvars, theta, dict_ty) = splitSigmaTy poly_ty'
        constr                   = classesOfPreds theta
@@ -368,8 +365,8 @@ tcInstDecl2 (InstInfo clas inst_tyvars inst_tys
 
        -- tcMethodBind has checked that the class_tyvars havn't
        -- been unified with each other or another type, but we must
-       -- still zonk them
-    mapNF_Tc zonkTcTyVarBndr inst_tyvars'      `thenNF_Tc` \ zonked_inst_tyvars ->
+       -- still zonk them before passing them to tcSimplifyAndCheck
+    zonkTcSigTyVars inst_tyvars'       `thenNF_Tc` \ zonked_inst_tyvars ->
     let
         inst_tyvars_set = mkVarSet zonked_inst_tyvars