module Hydra.Lib.Sets where

import qualified Data.Set as S


contains :: Ord a => a -> S.Set a -> Bool
contains :: forall a. Ord a => a -> Set a -> Bool
contains = forall a. Ord a => a -> Set a -> Bool
S.member

fromList :: Ord a => [a] -> S.Set a
fromList :: forall a. Ord a => [a] -> Set a
fromList = forall a. Ord a => [a] -> Set a
S.fromList

insert :: Ord a => a -> S.Set a -> S.Set a
insert :: forall a. Ord a => a -> Set a -> Set a
insert = forall a. Ord a => a -> Set a -> Set a
S.insert

isEmpty :: S.Set a -> Bool
isEmpty :: forall a. Set a -> Bool
isEmpty = forall a. Set a -> Bool
S.null

-- Note: the presence of a 'map' function does not imply that sets are a functor in Hydra
map :: Ord b => (a -> b) -> S.Set a -> S.Set b
map :: forall b a. Ord b => (a -> b) -> Set a -> Set b
map a -> b
f = forall a. Ord a => [a] -> Set a
S.fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Set a -> [a]
S.toList

remove :: Ord a => a -> S.Set a -> S.Set a
remove :: forall a. Ord a => a -> Set a -> Set a
remove = forall a. Ord a => a -> Set a -> Set a
S.delete

singleton :: a -> S.Set a
singleton :: forall a. a -> Set a
singleton = forall a. a -> Set a
S.singleton

size :: S.Set a -> Int
size :: forall a. Set a -> Int
size = forall a. Set a -> Int
S.size

toList :: Ord a => S.Set a -> [a]
toList :: forall a. Ord a => Set a -> [a]
toList = forall a. Set a -> [a]
S.toList