From 0ec171c9aa15390e8579c14d996d1f8be20b7b55 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 15 May 2012 00:22:31 +1000 Subject: Added functions to find type variables in terms and types --- TypeVar.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'TypeVar.hs') diff --git a/TypeVar.hs b/TypeVar.hs index 049a9e2..904eab7 100644 --- a/TypeVar.hs +++ b/TypeVar.hs @@ -63,3 +63,8 @@ mkEqualsType ty = typeFunc (AType [] (TypeOp (Name [] "bool"))) (typeFunc ty ty) typeFunc :: Type -> Type -> Type typeFunc ty1 ty2 = AType [ty1,ty2] (TypeOp (Name [] "->")) + + +typeVarsInType :: Type -> Set Type +typeVarsInType (TypeVar t) = Set.singleton (TypeVar t) +typeVarsInType (AType list _) = unions . (map typeVarsInType) $ list -- cgit