-Coercion WExprVar : WeakExprVar >-> WeakVar.
-Coercion WTypeVar : WeakTypeVar >-> WeakVar.
-Coercion WCoerVar : WeakCoerVar >-> WeakVar.
-
-
-Definition haskLiteralToCoreType lit : CoreType :=
- TyConApp (haskLiteralToTyCon lit) nil.
-
-Definition weakTypeToCoreType (wt:CoreType) : CoreType := wt.
-
-Definition weakTypeToString : CoreType -> string :=
- coreTypeToString ○ weakTypeToCoreType.
-
+ Coercion WExprVar : WeakExprVar >-> WeakVar.
+ Coercion WTypeVar : WeakTypeVar >-> WeakVar.
+ Coercion WCoerVar : WeakCoerVar >-> WeakVar.
+
+Definition weakTypeVarToKind (tv:WeakTypeVar) : Kind :=
+ match tv with weakTypeVar _ k => k end.
+ Coercion weakTypeVarToKind : WeakTypeVar >-> Kind.
+
+Definition weakVarToCoreVar (wv:WeakVar) : CoreVar :=
+ match wv with
+ | WExprVar (weakExprVar v _ ) => v
+ | WTypeVar (weakTypeVar v _ ) => v
+ | WCoerVar (weakCoerVar v _ _ _) => v
+ end.
+ Coercion weakVarToCoreVar : WeakVar >-> CoreVar.
+
+Definition haskLiteralToWeakType lit : WeakType :=
+ WTyCon (haskLiteralToTyCon lit).
+ Coercion haskLiteralToWeakType : HaskLiteral >-> WeakType.
+
+Variable coreVarToWeakVar : CoreVar -> WeakVar. Extract Inlined Constant coreVarToWeakVar => "coreVarToWeakVar".
+Variable getTyConTyVars_ : CoreTyCon -> list CoreVar. Extract Inlined Constant getTyConTyVars_ => "getTyConTyVars".
+Definition tyConTyVars (tc:CoreTyCon) :=
+ General.filter (map (fun x => match coreVarToWeakVar x with WTypeVar v => Some v | _ => None end) (getTyConTyVars_ tc)).
+ Opaque tyConTyVars.
+Definition tyConKind (tc:TyCon) : list Kind :=
+ map (fun (x:WeakTypeVar) => x:Kind) (tyConTyVars tc).
+
+Variable rawTyFunKind : CoreTyCon -> Kind. Extract Inlined Constant rawTyFunKind => "(coreKindToKind . TyCon.tyConKind)".
+
+Definition tyFunKind (tc:TyFun) : ((list Kind) * Kind) :=
+ splitKind (rawTyFunKind tc).
+
+(*