diff options
author | Jed Barber <jjbarber@y7mail.com> | 2012-05-15 00:22:31 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2012-05-15 00:28:55 +1000 |
commit | 0ec171c9aa15390e8579c14d996d1f8be20b7b55 (patch) | |
tree | 2e3fe3856b22b944e7bdbccd298d8e0a61e45199 /TypeVar.hs | |
parent | a7f9f3c3952978279d9406f2e1ed728582696125 (diff) |
Added functions to find type variables in terms and types
Diffstat (limited to 'TypeVar.hs')
-rw-r--r-- | TypeVar.hs | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 |