stm-containers-0.1.3: Containers for STM

Safe HaskellNone

STMContainers.Set

Synopsis

Documentation

data Set e Source

A hash set, based on an STM-specialized hash array mapped trie.

type Element a = (Eq a, Hashable a)Source

A standard constraint for elements.

new :: STM (Set e)Source

Construct a new set.

insert :: Element e => e -> Set e -> STM ()Source

Insert a new element.

delete :: Element e => e -> Set e -> STM ()Source

Delete an element.

lookup :: Element e => e -> Set e -> STM BoolSource

Lookup an element.

focus :: Element e => StrategyM STM () r -> e -> Set e -> STM rSource

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 still decide wether to keep or remove it.

foldM :: (a -> e -> STM a) -> a -> Set e -> STM aSource

Fold all the elements.

null :: Set e -> STM BoolSource

Check, whether the set is empty.