From 271bfd69c10cfd0e20d696f6d79b04e9b5ca28d8 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 22 Sep 2012 20:04:19 +1000 Subject: Added a function to check whether a given type is a type variable --- Library/TypeVar.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Library/TypeVar.hs b/Library/TypeVar.hs index fbb06a6..078d5d3 100644 --- a/Library/TypeVar.hs +++ b/Library/TypeVar.hs @@ -14,7 +14,8 @@ module Library.TypeVar ( mkEqualsType, typeFunc, typeBool, - typeVarsInType + typeVarsInType, + isTypeVar ) where @@ -75,3 +76,9 @@ typeBool = AType [] (TypeOp (Name [] "bool")) typeVarsInType :: Type -> Set.Set Type typeVarsInType (TypeVar t) = Set.singleton (TypeVar t) typeVarsInType (AType list _) = Set.unions . (map typeVarsInType) $ list + + +isTypeVar :: Type -> Bool +isTypeVar (TypeVar _) = True +isTypeVar _ = False + -- cgit