Safe Haskell | None |
---|---|
Language | Haskell2010 |
See Data.Rsv for an overview of what "reservation" data structures are.
This module implements a multi-map, where each insert is indexed by a key, and many independent inserts may be performed on the same key.
- data RMMap k a
- empty :: RMMap k a
- isEmpty :: RMMap k a -> Bool
- (!) :: Ord k => RMMap k a -> k -> [a]
- insert :: Ord k => k -> a -> RMMap k a -> (Delete k a, RMMap k a)
- type Delete k a = RMMap k a -> (Maybe a, RMMap k a)
- deleteKey :: Ord k => k -> RMMap k a -> RMMap k a
- sInsert :: (Ord k, Monad m) => k -> a -> StateT (RMMap k a) m (SDelete k a m)
- type SDelete k a m = StateT (RMMap k a) m (Maybe a)
- sDeleteKey :: (Ord k, Monad m) => k -> StateT (RMMap k a) m ()
Documentation
Read operations
Write operations
insert :: Ord k => k -> a -> RMMap k a -> (Delete k a, RMMap k a) Source
Add an item to the list, returning a handle to remove it with. The same item may be added twice, in which case it will occupy multiple positions in the map, and the handles distinguish these occurences.
type Delete k a = RMMap k a -> (Maybe a, RMMap k a) Source
A map-transition that removes and retrieves the earlier-added item.
If the item was already removed, Nothing
is returned instead.