Copyright | (c) Karl Cronburg 2018 |
---|---|
License | BSD3 |
Maintainer | karl@cs.tufts.edu |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype Map k v = Map (Map k (Set v))
- singleton :: (Hashable v, Eq v) => k -> v -> Map k v
- fromList :: (Hashable v, Ord k, Eq k, Eq v) => [(k, v)] -> Map k v
- fromList' :: (Ord k, Eq k, Hashable v, Eq v) => [(k, Set v)] -> Map k v
- toList :: Map k v -> [(k, Set v)]
- union :: (Ord k, Eq k, Hashable v, Eq v) => Map k v -> Map k v -> Map k v
- empty :: Map k v
- lookup :: (Ord k, Hashable v, Eq v) => k -> Map k v -> Set v
- size :: Map k v -> Int
- difference :: (Ord k, Eq v, Hashable v) => Map k v -> Map k v -> Map k v
Documentation
A multi Map
is a mapping from keys k
to sets of values v
. A nice
invariant to maintain while using a multi-map is to never have empty
sets mapped to by some key.
Instances
(Eq k, Eq v) => Eq (Map k v) Source # | |
(Show k, Show v) => Show (Map k v) Source # | |
Generic (Map k v) Source # | |
(Hashable v, Lift k, Lift v, Data k, Data v, Ord k, Ord v) => Lift (Map k v) Source # | |
(Hashable k, Hashable v) => Hashable (Map k v) Source # | |
Defined in Text.ANTLR.MultiMap | |
(Prettify k, Prettify v, Hashable v, Eq v) => Prettify (Map k v) Source # | |
type Rep (Map k v) Source # | |
singleton :: (Hashable v, Eq v) => k -> v -> Map k v Source #
The singleton multimap, given a single key and a single value.
fromList :: (Hashable v, Ord k, Eq k, Eq v) => [(k, v)] -> Map k v Source #
Construct a multi Map
from a list of key-value pairs.
fromList' :: (Ord k, Eq k, Hashable v, Eq v) => [(k, Set v)] -> Map k v Source #
Same as fromList
but where the values in the key-value tuples are already in sets.
union :: (Ord k, Eq k, Hashable v, Eq v) => Map k v -> Map k v -> Map k v Source #
Take the union of two maps.
lookup :: (Ord k, Hashable v, Eq v) => k -> Map k v -> Set v Source #
Get the set of values mapped to by some key k
.
difference :: (Ord k, Eq v, Hashable v) => Map k v -> Map k v -> Map k v Source #
Map difference of two multi-maps, deleting individual key-value pairs rather than deleting the entire key. Invariant maintained is that input maps with non-null value sets will result in an output with non-null value sets.