Hoogle Search
Within LTS Haskell 24.45 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
fromMap :: Map k [a] -> MultiMap k amultimap Data.MultiMap Turns a map of lists into a multimap.
toMap :: MultiMap k a -> Map k [a]multimap Data.MultiMap O(1). Return the map of lists.
toMapOfSets :: Ord a => MultiMap k a -> Map k (Set a)multimap Data.MultiMap /O(k*m*log m) where k is the number of keys and m the maximum number of elements associated with a single key/
-
No documentation available.
-
multimap Data.SetMap A SetMap with keys k and values v.
toMap :: SetMap k a -> Map k (Set a)multimap Data.SetMap O(1). Return the map of sets.
-
nonempty-containers Data.IntMap.NonEmpty A non-empty (by construction) map from integer keys to values a. At least one key-value pair exists in an NEIntMap v at all times. Functions that take an NEIntMap can safely operate on it with the assumption that it has at least one key-value pair. Functions that return an NEIntMap provide an assurance that the result has at least one key-value pair. Data.IntMap.NonEmpty re-exports the API of Data.IntMap, faithfully reproducing asymptotics, typeclass constraints, and semantics. Functions that ensure that input and output maps are both non-empty (like insert) return NEIntMap, but functions that might potentially return an empty map (like delete) return a IntMap instead. You can directly construct an NEIntMap with the API from Data.IntMap.NonEmpty; it's more or less the same as constructing a normal IntMap, except you don't have access to empty. There are also a few ways to construct an NEIntMap from a IntMap:
- The nonEmptyMap smart constructor will convert a IntMap k a into a Maybe (NEIntMap k a), returning Nothing if the original IntMap was empty.
- You can use the insertIntMap family of functions to insert a value into a IntMap to create a guaranteed NEIntMap.
- You can use the IsNonEmpty and IsEmpty patterns to "pattern match" on a IntMap to reveal it as either containing a NEIntMap or an empty map.
- withNonEmpty offers a continuation-based interface for deconstructing a IntMap and treating it as if it were an NEIntMap.
foldMapWithKey :: Semigroup m => (Key -> a -> m) -> NEIntMap a -> mnonempty-containers Data.IntMap.NonEmpty O(n). Fold the keys and values in the map using the given semigroup, such that
foldMapWithKey f = fold1 . mapWithKey f
WARNING: Differs from Data.IntMap.foldMapWithKey, which traverses positive items first, then negative items. This can be an asymptotically faster than foldrWithKey or foldlWithKey for some monoids.insertMap :: Key -> a -> IntMap a -> NEIntMap anonempty-containers Data.IntMap.NonEmpty O(log n). Convert a IntMap into an NEIntMap by adding a key-value pair. Because of this, we know that the map must have at least one element, and so therefore cannot be empty. If key is already present, will overwrite the original value. See insertMapMin for a version that is constant-time if the new key is strictly smaller than all keys in the original map.
insertMap 4 "c" (Data.IntMap.fromList [(5,"a"), (3,"b")]) == fromList ((3,"b") :| [(4,"c"), (5,"a")]) insertMap 4 "c" Data.IntMap.empty == singleton 4 "c"
insertMapMax :: Key -> a -> IntMap a -> NEIntMap anonempty-containers Data.IntMap.NonEmpty O(log n) Convert a IntMap into an NEIntMap by adding a key-value pair where the key is strictly greater than all keys in the input map. The keys in the original map must all be strictly less than the new key. The precondition is not checked. At the current moment, this is identical simply insertMap; however, it is left both for consistency and as a placeholder for a future version where optimizations are implemented to allow for a faster implementation.
insertMap 7 "c" (Data.IntMap.fromList [(5,"a"), (3,"b")]) == fromList ((3,"b") :| [(5,"a"), (7,"c")])