Set.purs 377 Bytes
Newer Older
1 2 3 4 5 6
module Gargantext.Utils.Set where

import Data.Ord (class Ord)
import Data.Set as Set


7 8 9
-- instance (Hashable a, Ord a) => Hashable (Set.Set a) where
--   hash s = hash $ A.sort $ A.fromFoldable s

10 11 12
-- | If `a` is in Set, remove it, otherwise add it
toggle :: forall a. Ord a => Set.Set a -> a -> Set.Set a
toggle s x = if Set.member x s then Set.delete x s else Set.insert x s