diff options
Diffstat (limited to 'src/Set.hs')
-rw-r--r-- | src/Set.hs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Set.hs b/src/Set.hs new file mode 100644 index 00000000..271828e8 --- /dev/null +++ b/src/Set.hs @@ -0,0 +1,36 @@ +module Set ( + Set, + member, + empty, singleton, delete, + union, unions, + elems, fromList +) where + +#if __GLASGOW_HASKELL__ < 503 +import Set +#else +import Data.Set +#endif + +#if __GLASGOW_HASKELL__ < 603 +member :: Ord a => a -> Set a -> Bool +member = elementOf + +empty :: Set a +empty = emptySet + +singleton :: a -> Set a +singleton = unitSet + +delete :: Ord a => a -> Set a -> Set a +delete = flip delFromSet + +unions :: Ord a => [Set a] -> Set a +unions = unionManySets + +elems :: Set a -> [a] +elems = setToList + +fromList :: Ord a => [a] -> Set a +fromList = mkSet +#endif |