summaryrefslogtreecommitdiff
path: root/Term.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Term.hs')
-rw-r--r--Term.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Term.hs b/Term.hs
index f351714..444ae1a 100644
--- a/Term.hs
+++ b/Term.hs
@@ -147,7 +147,7 @@ rename (TAbs (TVar v) t) vars =
typeOf :: Term -> Type
-typeOf (TConst c ty) = ty
+typeOf (TConst _ ty) = ty
typeOf (TVar v) = varTy v
typeOf (TAbs v t) = typeFunc (typeOf v) (typeOf t)
typeOf (TApp f _) =
@@ -155,6 +155,13 @@ typeOf (TApp f _) =
last . aType . typeOf $ f
+typeVarsInTerm :: Term -> Set Type
+typeVarsInTerm (TConst _ ty) = typeVarsInType ty
+typeVarsInTerm (TVar v) = typeVarsInType . varTy $ v
+typeVarsInTerm (TAbs v t) = Set.union (typeVarsInType . varTy $ v) (typeVarsInTerm t)
+typeVarsInTerm (TApp f x) = Set.union (typeVarsInTerm f) (typeVarsInTerm x)
+
+
mkEquals :: Term -> Term -> Term
mkEquals lhs rhs =
let eqConst = TConst (Const (Name [] "=")) (mkEqualsType (typeOf lhs))