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 :: Hashable key => Focus value STM result -> key -> Map key value -> STM result
- lookup :: Hashable key => key -> Map key value -> STM (Maybe value)
- insert :: Hashable key => value -> key -> Map key value -> STM ()
- delete :: 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)
- listTNonAtomic :: Map key value -> ListT IO (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 :: 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.