Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Bimap leftKey rightKey
- new :: STM (Bimap leftKey rightKey)
- newIO :: IO (Bimap leftKey rightKey)
- null :: Bimap leftKey rightKey -> STM Bool
- size :: Bimap leftKey rightKey -> STM Int
- focusLeft :: (Hashable leftKey, Hashable rightKey) => Focus rightKey STM result -> leftKey -> Bimap leftKey rightKey -> STM result
- focusRight :: (Hashable leftKey, Hashable rightKey) => Focus leftKey STM result -> rightKey -> Bimap leftKey rightKey -> STM result
- lookupLeft :: Hashable leftKey => leftKey -> Bimap leftKey rightKey -> STM (Maybe rightKey)
- lookupRight :: Hashable rightKey => rightKey -> Bimap leftKey rightKey -> STM (Maybe leftKey)
- insertLeft :: (Hashable leftKey, Hashable rightKey) => rightKey -> leftKey -> Bimap leftKey rightKey -> STM ()
- insertRight :: (Hashable leftKey, Hashable rightKey) => leftKey -> rightKey -> Bimap leftKey rightKey -> STM ()
- deleteLeft :: (Hashable leftKey, Hashable rightKey) => leftKey -> Bimap leftKey rightKey -> STM ()
- deleteRight :: (Hashable leftKey, Hashable rightKey) => rightKey -> Bimap leftKey rightKey -> STM ()
- reset :: Bimap leftKey rightKey -> STM ()
- unfoldlM :: Bimap leftKey rightKey -> UnfoldlM STM (leftKey, rightKey)
- listT :: Bimap key value -> ListT STM (key, value)
Documentation
data Bimap leftKey rightKey Source #
Bidirectional map. Essentially, a bijection between subsets of its two argument types.
For one value of the left-hand type this map contains one value of the right-hand type and vice versa.
newIO :: IO (Bimap leftKey rightKey) Source #
Construct a new bimap in IO.
This is useful for creating it on a top-level using unsafePerformIO
,
because using atomically
inside unsafePerformIO
isn't possible.
focusLeft :: (Hashable leftKey, Hashable rightKey) => Focus rightKey STM result -> leftKey -> Bimap leftKey rightKey -> STM result Source #
Focus on a right value by the left value.
This function allows to perform composite operations in a single access to a map item. E.g., you can look up an item and delete it at the same time, or update it and return the new value.
focusRight :: (Hashable leftKey, Hashable rightKey) => Focus leftKey STM result -> rightKey -> Bimap leftKey rightKey -> STM result Source #
Focus on a left value by the right value.
This function allows to perform composite operations in a single access to a map item. E.g., you can look up an item and delete it at the same time, or update it and return the new value.
lookupLeft :: Hashable leftKey => leftKey -> Bimap leftKey rightKey -> STM (Maybe rightKey) Source #
Look up a right value by the left value.
lookupRight :: Hashable rightKey => rightKey -> Bimap leftKey rightKey -> STM (Maybe leftKey) Source #
Look up a left value by the right value.
insertLeft :: (Hashable leftKey, Hashable rightKey) => rightKey -> leftKey -> Bimap leftKey rightKey -> STM () Source #
Insert the association by the left value.
insertRight :: (Hashable leftKey, Hashable rightKey) => leftKey -> rightKey -> Bimap leftKey rightKey -> STM () Source #
Insert the association by the right value.
deleteLeft :: (Hashable leftKey, Hashable rightKey) => leftKey -> Bimap leftKey rightKey -> STM () Source #
Delete the association by the left value.
deleteRight :: (Hashable leftKey, Hashable rightKey) => rightKey -> Bimap leftKey rightKey -> STM () Source #
Delete the association by the right value.