stm-containers-1.2.0.3: Containers for STM
Safe HaskellSafe-Inferred
LanguageHaskell2010

StmContainers.Set

Synopsis

Documentation

data Set item Source #

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

new :: STM (Set item) Source #

Construct a new set.

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.

null :: Set item -> STM Bool Source #

Check, whether the set is empty.

size :: Set item -> STM Int Source #

Get the number of elements.

focus :: 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.

lookup :: Hashable item => item -> Set item -> STM Bool Source #

Lookup an element.

insert :: Hashable item => item -> Set item -> STM () Source #

Insert a new element.

delete :: Hashable item => item -> Set item -> STM () Source #

Delete an element.

reset :: Set item -> STM () Source #

Delete all the elements.

unfoldlM :: Set item -> UnfoldlM STM item Source #

Stream the elements actively.

Amongst other features this function provides an interface to folding.

listT :: Set item -> ListT STM item Source #

Stream the elements passively.