Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Set e
- type Element a = (Eq a, Hashable a)
- new :: STM (Set e)
- newIO :: IO (Set e)
- insert :: Element e => e -> Set e -> STM ()
- delete :: Element e => e -> Set e -> STM ()
- deleteAll :: Set e -> STM ()
- lookup :: Element e => e -> Set e -> STM Bool
- focus :: Element e => StrategyM STM () r -> e -> Set e -> STM r
- null :: Set e -> STM Bool
- size :: Set e -> STM Int
- stream :: Set e -> ListT STM e
Documentation
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 :: Element e => StrategyM STM () r -> e -> Set e -> STM r 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.