+
+ kind = tyVarKind tyvar
+ in
+
+ -- Hack alert! Certain system functions (like error) are quantified
+ -- over type variables with an 'open' kind (a :: ?). When we instantiate
+ -- these tyvars we want to make a type variable whose kind is (Type bv)
+ -- where bv is a boxity variable. This makes sure it's a type, but
+ -- is open about its boxity. We *don't* want to give the thing the
+ -- kind '?' (= Type AnyBox).
+ --
+ -- This is all a hack to avoid giving error it's "proper" type:
+ -- error :: forall bv. forall a::Type bv. String -> a
+
+ (if kind == openTypeKind then
+ newOpenTypeKind
+ else
+ returnNF_Tc kind) `thenNF_Tc` \ kind' ->
+
+ tcNewMutTyVar name kind'
+
+tcInstSigVar tyvar -- Very similar to tcInstTyVar
+ = tcGetUnique `thenNF_Tc` \ uniq ->
+ let
+ name = setNameUnique (tyVarName tyvar) uniq
+ kind = tyVarKind tyvar