Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Map k v
- empty :: Map k v
- singleton :: (Prim k, Ord k) => k -> k -> v -> Map k v
- lookup :: (Prim k, Ord k) => k -> Map k v -> Maybe v
- mapBijection :: (Prim k, Ord k) => (v -> w) -> Map k v -> Map k w
- fromSet :: Prim k => (k -> k -> v) -> Set k -> Map k v
- fromList :: (Ord k, Enum k, Prim k, Eq v) => [(k, k, v)] -> Map k v
- fromListAppend :: (Ord k, Enum k, Prim k, Semigroup v, Eq v) => [(k, k, v)] -> Map k v
- fromListN :: (Ord k, Enum k, Prim k, Eq v) => Int -> [(k, k, v)] -> Map k v
- fromListAppendN :: (Ord k, Enum k, Prim k, Semigroup v, Eq v) => Int -> [(k, k, v)] -> Map k v
Documentation
Instances
(Prim k, Ord k, Enum k, Eq v) => IsList (Map k v) Source # | |
(Prim k, Eq k, Eq v) => Eq (Map k v) Source # | |
(Prim k, Show k, Show v) => Show (Map k v) Source # | |
(Prim k, Ord k, Enum k, Semigroup v, Eq v) => Semigroup (Map k v) Source # | |
(Prim k, Ord k, Enum k, Semigroup v, Eq v) => Monoid (Map k v) Source # | |
type Item (Map k v) Source # | |
Defined in Data.Diet.Map.Strict.Unboxed.Lifted |
O(1) Create a diet map with a single element.
lookup :: (Prim k, Ord k) => k -> Map k v -> Maybe v Source #
O(log n) Lookup the value at a key in the map.
Map an equality morphism over the values in a diet map. An bijection
f
must satisfy the law:
∀ x y. x == y ↔ f x == f y
Since this does not actually use the Eq
constraint on the new value
type, it is lazy in the values.
fromSet :: Prim k => (k -> k -> v) -> Set k -> Map k v Source #
Convert a diet set to a diet map, constructing each value from the low and high key in its corresponding range.