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 :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => Focus rightKey STM result -> leftKey -> Bimap leftKey rightKey -> STM result
- focusRight :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => Focus leftKey STM result -> rightKey -> Bimap leftKey rightKey -> STM result
- lookupLeft :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => leftKey -> Bimap leftKey rightKey -> STM (Maybe rightKey)
- lookupRight :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => rightKey -> Bimap leftKey rightKey -> STM (Maybe leftKey)
- insertLeft :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => rightKey -> leftKey -> Bimap leftKey rightKey -> STM ()
- insertRight :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => leftKey -> rightKey -> Bimap leftKey rightKey -> STM ()
- deleteLeft :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => leftKey -> Bimap leftKey rightKey -> STM ()
- deleteRight :: (Eq leftKey, Hashable leftKey, Eq rightKey, 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 :: (Eq leftKey, Hashable leftKey, Eq rightKey, 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 :: (Eq leftKey, Hashable leftKey, Eq rightKey, 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 :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => leftKey -> Bimap leftKey rightKey -> STM (Maybe rightKey) Source #
Look up a right value by the left value.
lookupRight :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => rightKey -> Bimap leftKey rightKey -> STM (Maybe leftKey) Source #
Look up a left value by the right value.
insertLeft :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => rightKey -> leftKey -> Bimap leftKey rightKey -> STM () Source #
Insert the association by the left value.
insertRight :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => leftKey -> rightKey -> Bimap leftKey rightKey -> STM () Source #
Insert the association by the right value.
deleteLeft :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => leftKey -> Bimap leftKey rightKey -> STM () Source #
Delete the association by the left value.
deleteRight :: (Eq leftKey, Hashable leftKey, Eq rightKey, Hashable rightKey) => rightKey -> Bimap leftKey rightKey -> STM () Source #
Delete the association by the right value.