Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Multimap key value
- new :: STM (Multimap key value)
- newIO :: IO (Multimap key value)
- null :: Multimap key value -> STM Bool
- focus :: (Hashable key, Hashable value) => Focus () STM result -> value -> key -> Multimap key value -> STM result
- lookup :: (Hashable key, Hashable value) => value -> key -> Multimap key value -> STM Bool
- lookupByKey :: Hashable key => key -> Multimap key value -> STM (Maybe (Set value))
- insert :: (Hashable key, Hashable value) => value -> key -> Multimap key value -> STM ()
- delete :: (Hashable key, Hashable value) => value -> key -> Multimap key value -> STM ()
- deleteByKey :: Hashable key => key -> Multimap key value -> STM ()
- reset :: Multimap key value -> STM ()
- unfoldlM :: Multimap key value -> UnfoldlM STM (key, value)
- unfoldlMKeys :: Multimap key value -> UnfoldlM STM key
- unfoldlMByKey :: Hashable key => key -> Multimap key value -> UnfoldlM STM value
- listT :: Multimap key value -> ListT STM (key, value)
- listTKeys :: Multimap key value -> ListT STM key
- listTByKey :: Hashable key => key -> Multimap key value -> ListT STM value
Documentation
newIO :: IO (Multimap key value) Source #
Construct a new multimap in IO.
This is useful for creating it on a top-level using unsafePerformIO
,
because using atomically
inside unsafePerformIO
isn't possible.
focus :: (Hashable key, Hashable value) => Focus () STM result -> value -> key -> Multimap key value -> STM result Source #
Focus on an item by the value and the key.
This function allows to perform simultaneous lookup and modification.
The focus is over a unit since we already know, which value 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 key, Hashable value) => value -> key -> Multimap key value -> STM Bool Source #
Look up an item by a value and a key.
lookupByKey :: Hashable key => key -> Multimap key value -> STM (Maybe (Set value)) Source #
Look up all values by key.
insert :: (Hashable key, Hashable value) => value -> key -> Multimap key value -> STM () Source #
Insert an item.
delete :: (Hashable key, Hashable value) => value -> key -> Multimap key value -> STM () Source #
Delete an item by a value and a key.
deleteByKey :: Hashable key => key -> Multimap key value -> STM () Source #
Delete all values associated with the key.
unfoldlM :: Multimap key value -> UnfoldlM STM (key, value) Source #
Stream associations actively.
Amongst other features this function provides an interface to folding.