License | GPL-3 |
---|---|
Safe Haskell | Safe |
MultiBimap
Description
This module allows us to abstract a bidirectional multimap without having to worry about implementation details. It is useful in the translation between lambda expressions and names.
Based on the bimap package: https://hackage.haskell.org/package/bimap-0.3.2/docs/Data-Bimap.html
- data MultiBimap k v
- empty :: MultiBimap k v
- null :: MultiBimap k v -> Bool
- insert :: (Ord k, Ord v) => k -> v -> MultiBimap k v -> MultiBimap k v
- lookup :: Ord k => k -> MultiBimap k v -> [v]
- lookupR :: Ord v => v -> MultiBimap k v -> Maybe k
Documentation
data MultiBimap k v Source #
empty :: MultiBimap k v Source #
The empty multi-bimap
null :: MultiBimap k v -> Bool Source #
True if the multi-bimap is empty
insert :: (Ord k, Ord v) => k -> v -> MultiBimap k v -> MultiBimap k v Source #
Inserts a key-value in the multi-bimap. The value can have been used earlier.
lookup :: Ord k => k -> MultiBimap k v -> [v] Source #
Lookup a key in the multi-bimap, returning the list of associated values.
lookupR :: Ord v => v -> MultiBimap k v -> Maybe k Source #
Lookup a right value in the multi-bimap, returning the associated key.