X-Git-Url: http://git.megacz.com/?p=coq-hetmet.git;a=blobdiff_plain;f=src%2FHaskWeakVars.v;fp=src%2FHaskWeakVars.v;h=ee8d3cf9d8e0a7db004bdbf4fa47261cccd66409;hp=782c2a2c8cbf5708b8e82c9abd61552dc5264908;hb=8c26722a1ee110077968a8a166eb7130266b2035;hpb=b8f6adf700fa3c67feefaea3d2cf5c4626300489 diff --git a/src/HaskWeakVars.v b/src/HaskWeakVars.v index 782c2a2..ee8d3cf 100644 --- a/src/HaskWeakVars.v +++ b/src/HaskWeakVars.v @@ -47,6 +47,17 @@ 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 tyFunResultKind : CoreTyCon -> Kind. Extract Inlined Constant tyFunResultKind => "tyFunResultKind". +Definition tyFunKind (tc:TyFun) : ((list Kind) * Kind) := + ((map (fun (x:WeakTypeVar) => x:Kind) (tyConTyVars tc)) , (tyFunResultKind tc)). + (* EqDecidable instances for all of the above *) Instance WeakCoerVarEqDecidable : EqDecidable WeakCoerVar. apply Build_EqDecidable. @@ -85,3 +96,8 @@ Instance WeakVarEqDecidable : EqDecidable WeakVar. left; auto. right; intro X; apply n; inversion X; auto. Defined. + + + +Instance WeakVarToString : ToString WeakVar := + { toString := fun x => toString (weakVarToCoreVar x) }. \ No newline at end of file