+%************************************************************************
+%* *
+\subsection{Coercion variables}
+%* *
+%************************************************************************
+
+\begin{code}
+type CoVar = Var -- A coercion variable is simply a type
+ -- variable of kind (ty1 :=: ty2)
+coVarName = varName
+
+setCoVarUnique = setVarUnique
+setCoVarName = setVarName
+
+mkCoVar :: Name -> Kind -> CoVar
+mkCoVar name kind = ASSERT( isCoercionKind kind )
+ TyVar { varName = name
+ , realUnique = getKey# (nameUnique name)
+ , varType = kind
+ -- varType is always PredTy (EqPred t1 t2)
+ , isCoercionVar = True
+ }
+
+mkWildCoVar :: Kind -> TyVar
+-- A type variable that is never referred to,
+-- so its unique doesn't matter
+mkWildCoVar kind
+ = ASSERT( isCoercionKind kind )
+ TyVar { varName = mkSysTvName wild_uniq FSLIT("co_wild"),
+ realUnique = _ILIT(1),
+ varType = kind,
+ isCoercionVar = True }
+ where
+ wild_uniq = mkBuiltinUnique 1
+\end{code}