Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Map key value
- new :: STM (Map key value)
- newIO :: IO (Map key value)
- null :: Map key value -> STM Bool
- size :: Map key value -> STM Int
- focus :: (Eq key, Hashable key) => Focus value STM result -> key -> Map key value -> STM result
- lookup :: (Eq key, Hashable key) => key -> Map key value -> STM (Maybe value)
- insert :: (Eq key, Hashable key) => value -> key -> Map key value -> STM ()
- delete :: (Eq key, Hashable key) => key -> Map key value -> STM ()
- reset :: Map key value -> STM ()
- unfoldlM :: Map key value -> UnfoldlM STM (key, value)
- listT :: Map key value -> ListT STM (key, value)
Documentation
newIO :: IO (Map key value) Source #
Construct a new map in IO.
This is useful for creating it on a top-level using unsafePerformIO
,
because using atomically
inside unsafePerformIO
isn't possible.
focus :: (Eq key, Hashable key) => Focus value STM result -> key -> Map key value -> STM result Source #
Focus on a value by the key.
This function allows to perform composite operations in a single access to the map's row. E.g., you can look up a value and delete it at the same time, or update it and return the new value.
lookup :: (Eq key, Hashable key) => key -> Map key value -> STM (Maybe value) Source #
Look up an item.
insert :: (Eq key, Hashable key) => value -> key -> Map key value -> STM () Source #
Insert a value at a key.