tmapchan-0.0.3: An insert-ordered multimap (indexed FIFO) which consumes values as you lookup

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.STM.TMapChan

Contents

Synopsis

Documentation

newtype TMapChan k a #

Constructors

TMapChan 

Fields

insert :: Ord k => TMapChan k a -> k -> a -> STM () #

insertMany :: Ord k => TMapChan k a -> k -> [a] -> STM () #

insertFirst :: Ord k => TMapChan k a -> k -> a -> STM () #

Inserts the element to the head of the stack, to be viewed next

lookup :: Ord k => TMapChan k a -> k -> STM a #

Blocks until there's a value available to remove from the mutlimap

tryLookup :: Ord k => TMapChan k a -> k -> STM (Maybe a) #

lookupAll :: Ord k => TMapChan k a -> k -> STM [a] #

observe :: Ord k => TMapChan k a -> k -> STM a #

Blocks until there's a vale available to view, without removing it

tryObserve :: Ord k => TMapChan k a -> k -> STM (Maybe a) #

observeAll :: Ord k => TMapChan k a -> k -> STM [a] #

delete :: Ord k => TMapChan k a -> k -> STM () #

Deletes the next element in the map, if it exists. Doesn't block.

deleteAll :: Ord k => TMapChan k a -> k -> STM () #

Clears the queue at the key

Utils

getTChan :: Ord k => TMapChan k a -> k -> STM (TChan a) #

Creates a new one if it doesn't already exist

setTChan :: Ord k => TMapChan k a -> k -> TChan a -> STM () #

keys :: TMapChan k a -> STM [k] #

broadcast :: Ord k => TMapChan k a -> a -> STM () #

Insert for every key

cloneAt #

Arguments

:: Ord k 
=> TMapChan k a 
-> k

key to clone from

-> k

key to clone to

-> STM () 

cloneAll :: Ord k => TMapChan k a -> k -> STM () #

Clones all the content for every key, by the key.

cloneAllUniquely :: (Ord k, Ord a) => TMapChan k a -> k -> STM () #

Clones all the content from every channel, and inserts the unique subset of them to k, in the order of their Ord instance