import TcUnify ( Expected(..), tcInfer, zapExpectedType, zapExpectedTo, tcSubExp, tcGen,
unifyFunTys, zapToListTy, zapToTyConApp )
import BasicTypes ( isMarkedStrict )
-import Inst ( InstOrigin(..),
- newOverloadedLit, newMethodFromName, newIPDict,
+import Inst ( newOverloadedLit, newMethodFromName, newIPDict,
newDicts, newMethodWithGivenTy, tcInstStupidTheta, tcInstCall )
import TcBinds ( tcBindsAndThen )
import TcEnv ( tcLookup, tcLookupId, checkProcLevel,
import TyCon ( TyCon, FieldLabel, tyConTyVars, tyConStupidTheta,
tyConDataCons, tyConFields )
import Type ( zipTopTvSubst, substTheta, substTy )
+import Var ( tyVarKind )
import VarSet ( emptyVarSet, elemVarSet )
import TysWiredIn ( boolTy, parrTyCon, tupleTyCon )
import PrelNames ( enumFromName, enumFromThenName,
non_upd_field_lbls = concat relevant_field_lbls_s `minusList` upd_field_lbls
common_tyvars = tyVarsOfTypes [ty | (fld,ty,_) <- tyConFields tycon,
fld `elem` non_upd_field_lbls]
+ is_common_tv tv = tv `elemVarSet` common_tyvars
- mk_inst_ty tyvar result_inst_ty
- | tyvar `elemVarSet` common_tyvars = returnM result_inst_ty -- Same as result type
--- gaw 2004 FIX?
- | otherwise = newTyFlexiVarTy liftedTypeKind -- Fresh type
+ mk_inst_ty tv result_inst_ty
+ | is_common_tv tv = returnM result_inst_ty -- Same as result type
+ | otherwise = newTyFlexiVarTy (tyVarKind tv) -- Fresh type, of correct kind
in
zipWithM mk_inst_ty tycon_tyvars result_inst_tys `thenM` \ inst_tys ->
-> do { checkProcLevel id proc_level
; tc_local_id id th_level }
- ; other -> pprPanic "tcId" (ppr id_name $$ ppr thing)
+ -- THis
+ ; other -> failWithTc (ppr other <+> ptext SLIT("used where a value identifer was expected"))
}
where