Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Set item
- new :: STM (Set item)
- newIO :: IO (Set item)
- null :: Set item -> STM Bool
- size :: Set item -> STM Int
- focus :: (Eq item, Hashable item) => Focus () STM result -> item -> Set item -> STM result
- lookup :: (Eq item, Hashable item) => item -> Set item -> STM Bool
- insert :: (Eq item, Hashable item) => item -> Set item -> STM ()
- delete :: (Eq item, Hashable item) => item -> Set item -> STM ()
- reset :: Set item -> STM ()
- unfoldlM :: Set item -> UnfoldlM STM item
- listT :: Set item -> ListT STM item
Documentation
newIO :: IO (Set item) Source #
Construct a new set in IO.
This is useful for creating it on a top-level using unsafePerformIO
,
because using atomically
inside unsafePerformIO
isn't possible.
focus :: (Eq item, Hashable item) => Focus () STM result -> item -> Set item -> STM result Source #
Focus on an element with a strategy.
This function allows to perform simultaneous lookup and modification.
The strategy is over a unit since we already know, which element we're focusing on and it doesn't make sense to replace it, however we still can decide wether to keep or remove it.