-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Deeply-nested, multiple key type maps. -- -- Please see the README at https://github.com/mixphix/deep-map @package deep-map @version 0.3.1 -- | This module defines a deeply-nested, semigroup-lifting map datatype, -- whose keys are indexed by a type-level list. -- -- Its interface is intended to mimic that of Map from the -- containers package, with additional convenience functions for -- working with deep nestings. module Data.Map.Deep data DeepMap (ks :: [Type]) (v :: Type) :: Type [Core] :: v -> DeepMap '[] v [Wrap] :: Ord k => Map k (DeepMap ks v) -> DeepMap (k ': ks) v -- | Apply a two-argument function through a shallow DeepMap, akin -- to liftA2. onCore2 :: (v -> w -> x) -> DeepMap '[] v -> DeepMap '[] w -> DeepMap '[] x -- | Apply a two-argument Map function through a deep -- DeepMap, akin to liftA2. onWrap2 :: (Map k (DeepMap ks v) -> Map k (DeepMap ls w) -> Map k (DeepMap ms x)) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ms) x -- | O(1). The empty, arbitrary positive-depth DeepMap. empty :: Ord k => DeepMap (k ': ks) v -- | O(1). A depth-1 DeepMap with a single key/value pair. singleton :: Ord k => k -> v -> DeepMap '[k] v deep :: Deep ks -> v -> DeepMap ks v -- | A singleton DeepMap. Use with (@|) to create deep -- nestings: -- --
-- >>> "Outer" @> 0 @| [5]
-- Wrap {fromList [("Outer",Wrap {fromList [(0,Core [5])]})]}
--
(@>) :: Ord k => k -> DeepMap ks v -> DeepMap (k ': ks) v
infixr 6 @>
-- | Infix synonym for singleton. Use with (@>) to create
-- deep nestings:
--
--
-- >>> "Outer" @> 0 @| [5]
-- Wrap {fromList [("Outer",Wrap {fromList [(0,Core [5])]})]}
--
(@|) :: Ord k => k -> v -> DeepMap '[k] v
infixr 6 @|
-- | O(n log n). Build a deeper DeepMap from a list of
-- key/DeepMap pairs. If the list contains more than one value for
-- the same key, the values are combined using (<>).
fromList :: (Ord k, Semigroup (DeepMap ks v)) => [(k, DeepMap ks v)] -> DeepMap (k ': ks) v
fromListDeep :: Monoid (DeepMap ks v) => [(Deep ks, v)] -> DeepMap ks v
-- | O(n log n). Build a depth-1 DeepMap from a list of
-- key/value pairs. If the list contains more than one value for the same
-- key, the values are combined using (<>).
fromList1 :: (Ord k, Semigroup v) => [(k, v)] -> DeepMap '[k] v
-- | O(n log n). Build a depth-2 DeepMap from a list of keys
-- and values. If the list contains more than one value for the same
-- keys, the values are combined using (<>).
fromList2 :: (Ord k0, Ord k1, Semigroup v) => [(k0, k1, v)] -> DeepMap '[k0, k1] v
-- | O(n log n). Build a depth-3 DeepMap from a list of keys
-- and values. If the list contains more than one value for the same
-- keys, the values are combined using (<>).
fromList3 :: (Ord k0, Ord k1, Ord k2, Semigroup v) => [(k0, k1, k2, v)] -> DeepMap '[k0, k1, k2] v
-- | O(n log n). Build a depth-4 DeepMap from a list of keys
-- and values. If the list contains more than one value for the same
-- keys, the values are combined using (<>).
fromList4 :: (Ord k0, Ord k1, Ord k2, Ord k3, Semigroup v) => [(k0, k1, k2, k3, v)] -> DeepMap '[k0, k1, k2, k3] v
-- | O(n log n). Build a depth-5 DeepMap from a list of keys
-- and values. If the list contains more than one value for the same
-- keys, the values are combined using (<>).
fromList5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4, Semigroup v) => [(k0, k1, k2, k3, k4, v)] -> DeepMap '[k0, k1, k2, k3, k4] v
-- | O(n log n). Build a deeper DeepMap from a list of
-- key/DeepMap pairs using the provided combining function.
fromListWith :: Ord k => (DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> [(k, DeepMap ks v)] -> DeepMap (k ': ks) v
-- | O(n log n). Build a depth-1 DeepMap from a list of
-- key/value pairs using the provided combining function.
fromListWith1 :: Ord k => (v -> v -> v) -> [(k, v)] -> DeepMap '[k] v
-- | O(n log n). Build a deeper DeepMap from a list of
-- key/DeepMap pairs with a combining function.
fromListWithKey :: Ord k => (k -> DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> [(k, DeepMap ks v)] -> DeepMap (k ': ks) v
-- | O(n log n). Build a depth-1 DeepMap from a list of
-- key/value pairs with a combining function.
fromListWithKey1 :: Ord k => (k -> v -> v -> v) -> [(k, v)] -> DeepMap '[k] v
-- | O(n log n). Build a depth-2 DeepMap from a list of keys
-- and values with a combining function.
fromListWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> v -> v) -> [(k0, k1, v)] -> DeepMap '[k0, k1] v
-- | O(n log n). Build a depth-3 DeepMap from a list of keys
-- and values with a combining function.
fromListWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> v -> v) -> [(k0, k1, k2, v)] -> DeepMap '[k0, k1, k2] v
-- | O(n log n). Build a depth-3 DeepMap from a list of keys
-- and values with a combining function.
fromListWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> v -> v) -> [(k0, k1, k2, k3, v)] -> DeepMap '[k0, k1, k2, k3] v
-- | O(n log n). Build a depth-3 DeepMap from a list of keys
-- and values with a combining function.
fromListWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> v -> v) -> [(k0, k1, k2, k3, k4, v)] -> DeepMap '[k0, k1, k2, k3, k4] v
-- | Half of the isomorphism of a depth-1 DeepMap to a Map.
-- See also fromMap.
toMap :: DeepMap '[k] v -> Map k v
-- | Half of the isomorphism of a depth-1 DeepMap to a Map.
-- See also toMap.
fromMap :: Ord k => Map k v -> DeepMap '[k] v
-- | O(log n). Insert a key/DeepMap pair into the
-- DeepMap. If the key is already present in the map, the
-- associated value is combined with the new value as old
-- <> new. The overwriting behaviour from
-- containers can be recovered by wrapping values in Last
-- or by using overwrite.
insert :: (Ord k, Semigroup (DeepMap ks v)) => k -> DeepMap ks v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
insertDeep :: (Ord k, Semigroup (DeepMap ks v)) => Deep (k ': ks) -> v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Insert a new key and value into a depth-1
-- DeepMap. If the key is already present in the map, the
-- associated value is combined with the new value as old
-- <> new. The overwriting behaviour from
-- containers can be recovered by wrapping values in Last
-- or by using overwrite1.
insert1 :: (Ord k, Semigroup v) => k -> v -> DeepMap '[k] v -> DeepMap '[k] v
-- | O(log n). Insert a new key-chain/value pair into a depth-2
-- DeepMap. If the key is already present in the map, the
-- associated value is combined with the new value as old
-- <> new. The overwriting behaviour from
-- containers can be recovered by wrapping values in Last
-- or by using overwrite2.
insert2 :: (Ord k0, Ord k1, Semigroup v) => k0 -> k1 -> v -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v
-- | O(log n). Insert a new key-chain/value pair into a depth-3
-- DeepMap. If the key is already present in the map, the
-- associated value is combined with the new value as old
-- <> new. so the overwriting behaviour from
-- containers can be recovered by wrapping values in Last
-- or by using overwrite3.
insert3 :: (Ord k0, Ord k1, Ord k2, Semigroup v) => k0 -> k1 -> k2 -> v -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v
-- | O(log n). Insert a new key-chain/value pair into a depth-4
-- DeepMap. If the key is already present in the map, the
-- associated value is combined with the new value as old
-- <> new. so the overwriting behaviour from
-- containers can be recovered by wrapping values in Last
-- or by using overwrite4.
insert4 :: (Ord k0, Ord k1, Ord k2, Ord k3, Semigroup v) => k0 -> k1 -> k2 -> k3 -> v -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v
-- | O(log n). Insert a new key-chain/value pair into a depth-5
-- DeepMap. If the key is already present in the map, the
-- associated value is combined with the new value as old
-- <> new. so the overwriting behaviour from
-- containers can be recovered by wrapping values in Last
-- or by using overwrite5.
insert5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4, Semigroup v) => k0 -> k1 -> k2 -> k3 -> k4 -> v -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function.
--
-- insertWith (~~) k new m will insert new at
-- k if there is no value present, or overwrite with old ~~
-- new if there was already a value old at k.
insertWith :: Ord k => (DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> k -> DeepMap ks v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function.
--
-- insertWith1 (~~) k new m will insert new at
-- k if there is no value present, or overwrite with old ~~
-- new if there was already a value old at k.
insertWith1 :: Ord k => (v -> v -> v) -> k -> v -> DeepMap '[k] v -> DeepMap '[k] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function.
insertWith2 :: (Ord k0, Ord k1) => (v -> v -> v) -> k0 -> k1 -> v -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function.
insertWith3 :: (Ord k0, Ord k1, Ord k2) => (v -> v -> v) -> k0 -> k1 -> k2 -> v -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function.
insertWith4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (v -> v -> v) -> k0 -> k1 -> k2 -> k3 -> v -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function.
insertWith5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (v -> v -> v) -> k0 -> k1 -> k2 -> k3 -> k4 -> v -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function.
--
-- insertWithKey f k new m will insert new at
-- k if there is no value present, or f k old new if
-- there was already a value old at k. The key passed
-- to f is the one passed to insertWithKey, not the one
-- present in the map.
insertWithKey :: Ord k => (k -> DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> k -> DeepMap ks v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function with access to the given keys.
insertWithKey1 :: Ord k => (k -> v -> v -> v) -> k -> v -> DeepMap '[k] v -> DeepMap '[k] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function with access to the given keys.
insertWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> v -> v) -> k0 -> k1 -> v -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function with access to the given keys.
insertWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> v -> v) -> k0 -> k1 -> k2 -> v -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function with access to the given keys.
insertWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> v -> v) -> k0 -> k1 -> k2 -> k3 -> v -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v
-- | O(log n). Insert with a function, combining new value and old
-- value using the supplied function with access to the given keys.
insertWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> v -> v) -> k0 -> k1 -> k2 -> k3 -> k4 -> v -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v
-- | O(log n). Combines insertion and retrieval.
--
-- -- 'insertLookupWithKey' f k new == 'lookup' k &&& 'insertWithKey' f k new --insertLookupWithKey :: Ord k => (k -> DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> k -> DeepMap ks v -> DeepMap (k ': ks) v -> (Maybe (DeepMap ks v), DeepMap (k ': ks) v) -- | O(log n). Combines insertion and retrieval. insertLookupWithKey1 :: Ord k => (k -> v -> v -> v) -> k -> v -> DeepMap '[k] v -> (Maybe v, DeepMap '[k] v) -- | O(log n). Combines insertion and retrieval. insertLookupWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> v -> v) -> k0 -> k1 -> v -> DeepMap '[k0, k1] v -> (Maybe v, DeepMap '[k0, k1] v) -- | O(log n). Combines insertion and retrieval. insertLookupWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> v -> v) -> k0 -> k1 -> k2 -> v -> DeepMap '[k0, k1, k2] v -> (Maybe v, DeepMap '[k0, k1, k2] v) -- | O(log n). Combines insertion and retrieval. insertLookupWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> v -> v) -> k0 -> k1 -> k2 -> k3 -> v -> DeepMap '[k0, k1, k2, k3] v -> (Maybe v, DeepMap '[k0, k1, k2, k3] v) -- | O(log n). Combines insertion and retrieval. insertLookupWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> v -> v) -> k0 -> k1 -> k2 -> k3 -> k4 -> v -> DeepMap '[k0, k1, k2, k3, k4] v -> (Maybe v, DeepMap '[k0, k1, k2, k3, k4] v) -- | O(log n). Insert a new key/DeepMap pair into the -- DeepMap. If the key is already present in the map, the -- associated value is replaced by the new value. overwrite :: Ord k => k -> DeepMap ks v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v overwriteDeep :: (Ord k, Semigroup (DeepMap ks v)) => Deep (k ': ks) -> v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(log n). Insert a new key/value pair into a depth-1 -- DeepMap. If the key is already present in the map, the -- associated value is replaced by the new value. overwrite1 :: Ord k => k -> v -> DeepMap '[k] v -> DeepMap '[k] v -- | O(log n). Insert a new key-chain/value pair into a depth-2 -- DeepMap. If the key is already present in the map, the -- associated value is replaced by the new value. overwrite2 :: (Ord k0, Ord k1) => k0 -> k1 -> v -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(log n). Insert a new key-chain/value pair into a depth-3 -- DeepMap. If the key is already present in the map, the -- associated value is replaced by the new value. overwrite3 :: (Ord k0, Ord k1, Ord k2) => k0 -> k1 -> k2 -> v -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(log n). Insert a new key-chain/value pair into a depth-4 -- DeepMap. If the key is already present in the map, the -- associated value is replaced by the new value. overwrite4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => k0 -> k1 -> k2 -> k3 -> v -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(log n). Insert a new key-chain/value pair into a depth-5 -- DeepMap. If the key is already present in the map, the -- associated value is replaced by the new value. overwrite5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => k0 -> k1 -> k2 -> k3 -> k4 -> v -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(log n). Combines replacement and retrieval. overwriteLookup :: Ord k => k -> DeepMap ks v -> DeepMap (k ': ks) v -> (Maybe (DeepMap ks v), DeepMap (k ': ks) v) overwriteLookupDeep :: (Ord k, Semigroup (DeepMap ks v)) => Deep (k ': ks) -> v -> DeepMap (k ': ks) v -> (Maybe (DeepMap ks v), DeepMap (k ': ks) v) -- | O(log n). Combines replacement and retrieval at depth 1. overwriteLookup1 :: Ord k => k -> v -> DeepMap '[k] v -> (Maybe v, DeepMap '[k] v) -- | O(log n). Combines replacement and retrieval at depth 2. overwriteLookup2 :: (Ord k0, Ord k1) => k0 -> k1 -> v -> DeepMap '[k0, k1] v -> (Maybe v, DeepMap '[k0, k1] v) -- | O(log n). Combines replacement and retrieval at depth 3. overwriteLookup3 :: (Ord k0, Ord k1, Ord k2) => k0 -> k1 -> k2 -> v -> DeepMap '[k0, k1, k2] v -> (Maybe v, DeepMap '[k0, k1, k2] v) -- | O(log n). Combines replacement and retrieval at depth 4. overwriteLookup4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => k0 -> k1 -> k2 -> k3 -> v -> DeepMap '[k0, k1, k2, k3] v -> (Maybe v, DeepMap '[k0, k1, k2, k3] v) -- | O(log n). Combines replacement and retrieval at depth 5. overwriteLookup5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => k0 -> k1 -> k2 -> k3 -> k4 -> v -> DeepMap '[k0, k1, k2, k3, k4] v -> (Maybe v, DeepMap '[k0, k1, k2, k3, k4] v) -- | O(log n). Delete a key and its value from the map, or do -- nothing if the key is missing. delete :: Ord k => k -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v deleteDeep :: Monoid v => Deep ks -> DeepMap ks v -> DeepMap ks v -- | O(log n). Delete a key and its value from the map, or do -- nothing if the key is missing. delete1 :: Ord k => k -> DeepMap '[k] v -> DeepMap '[k] v -- | O(log n). Delete a key and its value from the map, or do -- nothing if the key is missing. delete2 :: (Ord k0, Ord k1) => k0 -> k1 -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(log n). Delete a key and its value from the map, or do -- nothing if the key is missing. delete3 :: (Ord k0, Ord k1, Ord k2) => k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(log n). Delete a key and its value from the map, or do -- nothing if the key is missing. delete4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(log n). Delete a key and its value from the map, or do -- nothing if the key is missing. delete5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(log n). Change a value at a specific key with the result of -- the provided function, or do nothing if the key is missing. adjust :: Ord k => (DeepMap ks v -> DeepMap ks v) -> k -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v adjustDeep :: (v -> v) -> Deep ks -> DeepMap ks v -> DeepMap ks v -- | O(log n). Change a value at a specific key with the result of -- the provided function, or do nothing if the key is missing. adjust1 :: Ord k => (v -> v) -> k -> DeepMap '[k] v -> DeepMap '[k] v -- | O(log n). Change a value at specific keys with the result of -- the provided function, or do nothing if the key is missing. adjust2 :: (Ord k0, Ord k1) => (v -> v) -> k0 -> k1 -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(log n). Change a value at specific keys with the result of -- the provided function, or do nothing if the key is missing. adjust3 :: (Ord k0, Ord k1, Ord k2) => (v -> v) -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(log n). Change a value at specific keys with the result of -- the provided function, or do nothing if the key is missing. adjust4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (v -> v) -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(log n). Change a value at specific keys with the result of -- the provided function, or do nothing if the key is missing. adjust5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (v -> v) -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(log n). Change a value at a specific key with access to the -- key itself, or do nothing if the key is missing. adjustWithKey :: Ord k => (k -> DeepMap ks v -> DeepMap ks v) -> k -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(log n). Change a value at a specific key with access to the -- key itself, or do nothing if the key is missing. adjustWithKey1 :: Ord k => (k -> v -> v) -> k -> DeepMap '[k] v -> DeepMap '[k] v -- | O(log n). Change a value at a specific key with access to the -- key itself, or do nothing if the key is missing. adjustWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> v) -> k0 -> k1 -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(log n). Change a value at a specific key with access to the -- key itself, or do nothing if the key is missing. adjustWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> v) -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(log n). Change a value at a specific key with access to the -- key itself, or do nothing if the key is missing. adjustWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> v) -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(log n). Change a value at a specific key with access to the -- key itself, or do nothing if the key is missing. adjustWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> v) -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(log n). Change a DeepMap at a specific key. If the -- function evaluates to Nothing, the key and submap are removed. -- If the key is missing, do nothing. update :: Ord k => (DeepMap ks v -> Maybe (DeepMap ks v)) -> k -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v updateDeep :: Monoid v => (v -> Maybe v) -> Deep ks -> DeepMap ks v -> DeepMap ks v -- | O(log n). Change a DeepMap at a specific key. If the -- function evaluates to Nothing, the key and submap are removed. -- If the key is missing, do nothing. update1 :: Ord k => (v -> Maybe v) -> k -> DeepMap '[k] v -> DeepMap '[k] v -- | O(log n). Change a DeepMap at a specific key. If the -- function evaluates to Nothing, the key and submap are removed. -- If the key is missing, do nothing. update2 :: (Ord k0, Ord k1) => (v -> Maybe v) -> k0 -> k1 -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(log n). Change a DeepMap at a specific key. If the -- function evaluates to Nothing, the key and submap are removed. -- If the key is missing, do nothing. update3 :: (Ord k0, Ord k1, Ord k2) => (v -> Maybe v) -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(log n). Change a DeepMap at a specific key. If the -- function evaluates to Nothing, the key and submap are removed. -- If the key is missing, do nothing. update4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(log n). Change a DeepMap at a specific key. If the -- function evaluates to Nothing, the key and submap are removed. -- If the key is missing, do nothing. update5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(log n). Change a DeepMap at a specific key, with -- access to the key itself. If the function evaluates to Nothing, -- the key and submap are removed. If the key is missing, do nothing. updateWithKey :: Ord k => (k -> DeepMap ks v -> Maybe (DeepMap ks v)) -> k -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(log n). Change a value at a specific key with access to the -- key itself. If the function evaluates to Nothing, the key and -- value are removed. If the key is missing, do nothing. updateWithKey1 :: Ord k => (k -> v -> Maybe v) -> k -> DeepMap '[k] v -> DeepMap '[k] v -- | O(log n). Change a value at specific keys with access to the -- keys themselves. If the function evaluates to Nothing, the keys -- and value are removed. If the keys are missing, do nothing. updateWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> Maybe v) -> k0 -> k1 -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(log n). Change a value at specific keys with access to the -- keys themselves. If the function evaluates to Nothing, the keys -- and value are removed. If the keys are missing, do nothing. updateWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> Maybe v) -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(log n). Change a value at specific keys with access to the -- keys themselves. If the function evaluates to Nothing, the keys -- and value are removed. If the keys are missing, do nothing. updateWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(log n). Change a value at specific keys with access to the -- keys themselves. If the function evaluates to Nothing, the keys -- and value are removed. If the keys are missing, do nothing. updateWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(log n). Combines change and retrieval. -- --
-- 'updateLookupWithKey' f k == 'lookup' k &&& 'updateWithKey' f k --updateLookupWithKey :: Ord k => (k -> DeepMap ks v -> Maybe (DeepMap ks v)) -> k -> DeepMap (k ': ks) v -> (Maybe (DeepMap ks v), DeepMap (k ': ks) v) -- | O(log n). Combines change and retrieval. updateLookupWithKey1 :: Ord k => (k -> v -> Maybe v) -> k -> DeepMap '[k] v -> (Maybe v, DeepMap '[k] v) -- | O(log n). Combines change and retrieval. updateLookupWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> Maybe v) -> k0 -> k1 -> DeepMap '[k0, k1] v -> (Maybe v, DeepMap '[k0, k1] v) -- | O(log n). Combines change and retrieval. updateLookupWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> Maybe v) -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> (Maybe v, DeepMap '[k0, k1, k2] v) -- | O(log n). Combines change and retrieval. updateLookupWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> (Maybe v, DeepMap '[k0, k1, k2, k3] v) -- | O(log n). Combines change and retrieval. updateLookupWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> (Maybe v, DeepMap '[k0, k1, k2, k3, k4] v) -- | O(log n). Can be used to insert, overwrite, -- delete, or update a value. alter :: Ord k => (Maybe (DeepMap ks v) -> Maybe (DeepMap ks v)) -> k -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v alterDeep :: Monoid v => (Maybe v -> Maybe v) -> Deep ks -> DeepMap ks v -> DeepMap ks v -- | O(log n). Can be used to insert, overwrite, -- delete, or update a value. alter1 :: Ord k => (Maybe v -> Maybe v) -> k -> DeepMap '[k] v -> DeepMap '[k] v -- | O(log n). Can be used to insert, overwrite, -- delete, or update a value. alter2 :: (Ord k0, Ord k1) => (Maybe v -> Maybe v) -> k0 -> k1 -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(log n). Can be used to insert, overwrite, -- delete, or update a value. alter3 :: (Ord k0, Ord k1, Ord k2) => (Maybe v -> Maybe v) -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(log n). Can be used to insert, overwrite, -- delete, or update a value. alter4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (Maybe v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(log n). Can be used to insert, overwrite, -- delete, or update a value. alter5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (Maybe v -> Maybe v) -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v alterF :: (Functor f, Ord k) => (Maybe (DeepMap ks v) -> f (Maybe (DeepMap ks v))) -> k -> DeepMap (k ': ks) v -> f (DeepMap (k ': ks) v) alterFDeep :: (Monoid v, Applicative f) => (Maybe v -> f (Maybe v)) -> Deep ks -> DeepMap ks v -> f (DeepMap ks v) alterF1 :: (Functor f, Ord k) => (Maybe v -> f (Maybe v)) -> k -> DeepMap '[k] v -> f (DeepMap '[k] v) alterF2 :: (Functor f, Ord k0, Ord k1) => (Maybe v -> f (Maybe v)) -> k0 -> k1 -> DeepMap '[k0, k1] v -> f (DeepMap '[k0, k1] v) alterF3 :: (Functor f, Ord k0, Ord k1, Ord k2) => (Maybe v -> f (Maybe v)) -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> f (DeepMap '[k0, k1, k2] v) alterF4 :: (Functor f, Ord k0, Ord k1, Ord k2, Ord k3) => (Maybe v -> f (Maybe v)) -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> f (DeepMap '[k0, k1, k2, k3] v) alterF5 :: (Functor f, Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (Maybe v -> f (Maybe v)) -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> f (DeepMap '[k0, k1, k2, k3, k4] v) -- | O(log n). Lookup the value at a key. lookup :: Ord k => k -> DeepMap (k ': ks) v -> Maybe (DeepMap ks v) lookupDeep :: Deep ks -> DeepMap ks v -> Maybe v -- | O(log n). A flipped, infix variant of lookup. (@?) :: Ord k => DeepMap (k ': ks) v -> k -> Maybe (DeepMap ks v) -- | O(log n). A flipped, infix variant of lookup1. (@?|) :: Ord k => DeepMap '[k] v -> k -> Maybe v -- | O(log n). Facilitates chaining of lookups. For m :: DeepMap -- '[k0, k1, k2] v, -- --
-- >>> m @? k0 @?? k1 @??| k2 == (m @? k0) >>= (@? k1) >>= (@?| k2) --(@??) :: Ord k => Maybe (DeepMap (k ': ks) v) -> k -> Maybe (DeepMap ks v) -- | O(log n). Facilitates chaining of lookups. For m :: DeepMap -- '[k0, k1, k2] v, -- --
-- >>> m @? k0 @?? k1 @??| k2 == (m @? k0) >>= (@? k1) >>= (@?| k2) --(@??|) :: Ord k => Maybe (DeepMap '[k] v) -> k -> Maybe v -- | O(log n). A version of (@?) that returns mempty -- when the element cannot be found. (@!) :: (Ord k, Monoid (DeepMap ks v)) => DeepMap (k ': ks) v -> k -> DeepMap ks v -- | O(log n). A version of (@?|) that returns mempty -- when the element cannot be found. (@!|) :: (Ord k, Monoid v) => DeepMap '[k] v -> k -> v -- | O(log n). Lookup the DeepMap at a key, with a default if -- the key is missing. findWithDefault :: Ord k => DeepMap ks v -> k -> DeepMap (k ': ks) v -> DeepMap ks v -- | O(log n). Lookup the value at a key, with a default if the key -- is missing. findWithDefault1 :: Ord k => v -> k -> DeepMap '[k] v -> v -- | O(log n). Lookup the value at a key, with a default if the key -- is missing. findWithDefault2 :: (Ord k0, Ord k1) => v -> k0 -> k1 -> DeepMap '[k0, k1] v -> v -- | O(log n). Lookup the value at a key, with a default if the key -- is missing. findWithDefault3 :: (Ord k0, Ord k1, Ord k2) => v -> k0 -> k1 -> k2 -> DeepMap '[k0, k1, k2] v -> v -- | O(log n). Lookup the value at a key, with a default if the key -- is missing. findWithDefault4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => v -> k0 -> k1 -> k2 -> k3 -> DeepMap '[k0, k1, k2, k3] v -> v -- | O(log n). Lookup the value at a key, with a default if the key -- is missing. findWithDefault5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => v -> k0 -> k1 -> k2 -> k3 -> k4 -> DeepMap '[k0, k1, k2, k3, k4] v -> v -- | O(log n). Is the key a member of the map? See also -- notMember. member :: Ord k => k -> DeepMap (k ': ks) v -> Bool -- | O(log n). Is the key missing from the map? See also -- member. notMember :: Ord k => k -> DeepMap (k ': ks) v -> Bool -- | Find the next smallest key to the given one, and return its key/value -- pair. lookupLT :: Ord k => k -> DeepMap (k ': ks) v -> Maybe (k, DeepMap ks v) -- | Find the next largest key to the given one, and return its key/value -- pair. lookupGT :: Ord k => k -> DeepMap (k ': ks) v -> Maybe (k, DeepMap ks v) -- | Find the largest key up to the given one, and return its key/value -- pair. lookupLE :: Ord k => k -> DeepMap (k ': ks) v -> Maybe (k, DeepMap ks v) -- | Find the smallest key down to the given one, and return its key/value -- pair. lookupGE :: Ord k => k -> DeepMap (k ': ks) v -> Maybe (k, DeepMap ks v) -- | O(1). Is the DeepMap empty? null :: DeepMap (k ': ks) v -> Bool -- | O(1). The number of outermost keys in the DeepMap. size :: DeepMap (k ': ks) v -> Int -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps -- together using (<>) to combine the values of duplicate -- keys. -- -- To retain Map's left-biased functionality, use -- unionWith const. union :: (Ord k, Semigroup (DeepMap ks v)) => DeepMap (k ': ks) v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function. unionWith :: Ord k => (DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function. unionWith1 :: Ord k => (v -> v -> v) -> DeepMap '[k] v -> DeepMap '[k] v -> DeepMap '[k] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function. unionWith2 :: (Ord k0, Ord k1) => (v -> v -> v) -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function. unionWith3 :: (Ord k0, Ord k1, Ord k2) => (v -> v -> v) -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function. unionWith4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (v -> v -> v) -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function. unionWith5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (v -> v -> v) -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(m log(n / m + 1)), m <= n. Join two maps with a combining -- function with access to the keys. unionWithKey :: Ord k => (k -> DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function with access to the keys. unionWithKey1 :: Ord k => (k -> v -> v -> v) -> DeepMap '[k] v -> DeepMap '[k] v -> DeepMap '[k] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function with access to the keys. unionWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> v -> v) -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function with access to the keys. unionWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> v -> v) -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function with access to the keys. unionWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> v -> v) -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(m log(n / m + 1)), m <= n. Join two DeepMaps with a -- combining function with access to the keys. unionWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> v -> v) -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | A synonym for fold. To retain Map's functionality, use -- unionsWith const. unions :: (Foldable t, Ord k, Semigroup (DeepMap ks v)) => t (DeepMap (k ': ks) v) -> DeepMap (k ': ks) v -- | The union of a list of DeepMaps, combining with a specified -- operation. unionsWith :: (Foldable t, Ord k) => (DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> t (DeepMap (k ': ks) v) -> DeepMap (k ': ks) v -- | The union of a list of DeepMaps, combining with a specified -- operation. unionsWith1 :: (Foldable t, Ord k) => (v -> v -> v) -> t (DeepMap '[k] v) -> DeepMap '[k] v -- | O(m log(n / m + 1)), m <= n. The set-difference of the keys -- in a DeepMap, keeping the values of the left-hand map. difference :: Ord k => DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ks) v -- | Infix synonym for difference. (\\) :: Ord k => DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ks) v -- | O(n + m). Difference with a combining function. Deletes keys if -- the value is Nothing. differenceWith :: Ord k => (DeepMap ks v -> DeepMap ls w -> Maybe (DeepMap ks v)) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ks) v -- | O(n + m). Difference with a combining function. Deletes keys if -- the value is Nothing. differenceWith1 :: Ord k => (v -> w -> Maybe v) -> DeepMap '[k] v -> DeepMap '[k] w -> DeepMap '[k] v -- | O(n + m). Difference with a combining function. Deletes keys if -- the value is Nothing. differenceWithKey :: Ord k => (k -> DeepMap ks v -> DeepMap ls w -> Maybe (DeepMap ks v)) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ks) v -- | O(n + m). Difference with a combining function. Deletes keys if -- the value is Nothing. differenceWithKey1 :: Ord k => (k -> v -> w -> Maybe v) -> DeepMap '[k] v -> DeepMap '[k] w -> DeepMap '[k] v -- | O(m log(n / m + 1)), m <= n. The set-intersection of the -- keys in a map, keeping the values of the left-hand map. intersection :: Ord k => DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ks) v -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWith :: Ord k => (DeepMap ks v -> DeepMap ls w -> DeepMap ms x) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ms) x -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWith1 :: Ord k => (v -> w -> x) -> DeepMap '[k] v -> DeepMap '[k] w -> DeepMap '[k] x -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWithKey :: Ord k => (k -> DeepMap ks v -> DeepMap ls w -> DeepMap ms x) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -> DeepMap (k ': ms) x -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWithKey1 :: Ord k => (k -> v -> w -> x) -> DeepMap '[k] v -> DeepMap '[k] w -> DeepMap '[k] x -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWithKey2 :: (Ord k0, Ord k1) => (k0 -> k1 -> v -> w -> x) -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] w -> DeepMap '[k0, k1] x -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWithKey3 :: (Ord k0, Ord k1, Ord k2) => (k0 -> k1 -> k2 -> v -> w -> x) -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] w -> DeepMap '[k0, k1, k2] x -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWithKey4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (k0 -> k1 -> k2 -> k3 -> v -> w -> x) -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] w -> DeepMap '[k0, k1, k2, k3] x -- | O(m log(n / m + 1)), m <= n. Intersection with a combining -- function. intersectionWithKey5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> w -> x) -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] w -> DeepMap '[k0, k1, k2, k3, k4] x -- | O(n). Strictly more general than fmap in that it may -- change the types of the inner keys. mapShallow :: (DeepMap ks v -> DeepMap ls w) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -- | O(n). Like mapShallow but the function has access to the -- outer keys. mapShallowWithKey :: (k -> DeepMap ks v -> DeepMap ls w) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -- | O(n). Like fmap but the function has access to the outer -- keys. mapWithKey1 :: (k -> v -> w) -> DeepMap '[k] v -> DeepMap '[k] w -- | O(n). Like fmap but the function has access to the outer -- keys. mapWithKey2 :: (k0 -> k1 -> v -> w) -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] w -- | O(n). Like fmap but the function has access to the outer -- keys. mapWithKey3 :: (k0 -> k1 -> k2 -> v -> w) -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] w -- | O(n). Like fmap but the function has access to the outer -- keys. mapWithKey4 :: (k0 -> k1 -> k2 -> k3 -> v -> w) -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] w -- | O(n). Like fmap but the function has access to the outer -- keys. mapWithKey5 :: (k0 -> k1 -> k2 -> k3 -> k4 -> v -> w) -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] w -- | O(n). Strictly more general than traverse in that it may -- change the types of the inner keys. traverseShallow :: Applicative f => (DeepMap ks v -> f (DeepMap ls w)) -> DeepMap (k ': ks) v -> f (DeepMap (k ': ls) w) -- | O(n). Like traverseShallow but the function has access -- to the keys. traverseShallowWithKey :: Applicative f => (k -> DeepMap ks v -> f (DeepMap ls w)) -> DeepMap (k ': ks) v -> f (DeepMap (k ': ls) w) -- | O(n). Like traverse but the function has access to the -- keys. traverseWithKey1 :: Applicative f => (k -> v -> f w) -> DeepMap '[k] v -> f (DeepMap '[k] w) -- | O(n). Like traverse but the function has access to the -- keys. traverseWithKey2 :: Applicative f => (k0 -> k1 -> v -> f w) -> DeepMap '[k0, k1] v -> f (DeepMap '[k0, k1] w) -- | O(n). Like traverse but the function has access to the -- keys. traverseWithKey3 :: Applicative f => (k0 -> k1 -> k2 -> v -> f w) -> DeepMap '[k0, k1, k2] v -> f (DeepMap '[k0, k1, k2] w) -- | O(n). Like traverse but the function has access to the -- keys. traverseWithKey4 :: Applicative f => (k0 -> k1 -> k2 -> k3 -> v -> f w) -> DeepMap '[k0, k1, k2, k3] v -> f (DeepMap '[k0, k1, k2, k3] w) -- | O(n). Like traverse but the function has access to the -- keys. traverseWithKey5 :: Applicative f => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> f w) -> DeepMap '[k0, k1, k2, k3, k4] v -> f (DeepMap '[k0, k1, k2, k3, k4] w) -- | O(n). Traverse keys/submaps and collect the Just -- results. traverseMaybeWithKey :: Applicative f => (k -> DeepMap ks v -> f (Maybe (DeepMap ls w))) -> DeepMap (k ': ks) v -> f (DeepMap (k ': ls) w) -- | O(n). Traverse keys/values and collect the Just results. traverseMaybeWithKey1 :: Applicative f => (k -> v -> f (Maybe w)) -> DeepMap '[k] v -> f (DeepMap '[k] w) -- | O(n). Traverse keys/values and collect the Just results. traverseMaybeWithKey2 :: Applicative f => (k0 -> k1 -> v -> f (Maybe w)) -> DeepMap '[k0, k1] v -> f (DeepMap '[k0, k1] w) -- | O(n). Traverse keys/values and collect the Just results. traverseMaybeWithKey3 :: Applicative f => (k0 -> k1 -> k2 -> v -> f (Maybe w)) -> DeepMap '[k0, k1, k2] v -> f (DeepMap '[k0, k1, k2] w) -- | O(n). Traverse keys/values and collect the Just results. traverseMaybeWithKey4 :: Applicative f => (k0 -> k1 -> k2 -> k3 -> v -> f (Maybe w)) -> DeepMap '[k0, k1, k2, k3] v -> f (DeepMap '[k0, k1, k2, k3] w) -- | O(n). Traverse keys/values and collect the Just results. traverseMaybeWithKey5 :: Applicative f => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> f (Maybe w)) -> DeepMap '[k0, k1, k2, k3, k4] v -> f (DeepMap '[k0, k1, k2, k3, k4] w) -- | O(n). Thread an accumulating argument through the -- DeepMap in ascending order of keys. mapAccum :: (acc -> DeepMap ks v -> (acc, DeepMap ls w)) -> acc -> DeepMap (k ': ks) v -> (acc, DeepMap (k ': ls) w) -- | O(n). Thread an accumulating argument through the -- DeepMap in ascending order of keys. mapAccum1 :: (acc -> v -> (acc, w)) -> acc -> DeepMap '[k] v -> (acc, DeepMap '[k] w) -- | O(n). Thread an accumulating argument through the -- DeepMap in descending order of keys. mapAccumR :: (acc -> DeepMap ks v -> (acc, DeepMap ls w)) -> acc -> DeepMap (k ': ks) v -> (acc, DeepMap (k ': ls) w) -- | O(n). Thread an accumulating argument through the -- DeepMap in descending order of keys. mapAccumR1 :: (acc -> v -> (acc, w)) -> acc -> DeepMap '[k] v -> (acc, DeepMap '[k] w) -- | O(n). Like mapAccum but the function has access to the -- keys. mapAccumWithKey :: (acc -> k -> DeepMap ks v -> (acc, DeepMap ls w)) -> acc -> DeepMap (k ': ks) v -> (acc, DeepMap (k ': ls) w) -- | O(n). Like mapAccum but the function has access to the -- keys. mapAccumWithKey1 :: (acc -> k -> v -> (acc, w)) -> acc -> DeepMap '[k] v -> (acc, DeepMap '[k] w) -- | O(n). Like mapAccum but the function has access to the -- keys. mapAccumWithKey2 :: (acc -> k0 -> k1 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1] v -> (acc, DeepMap '[k0, k1] w) -- | O(n). Like mapAccum but the function has access to the -- keys. mapAccumWithKey3 :: (acc -> k0 -> k1 -> k2 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1, k2] v -> (acc, DeepMap '[k0, k1, k2] w) -- | O(n). Like mapAccum but the function has access to the -- keys. mapAccumWithKey4 :: (acc -> k0 -> k1 -> k2 -> k3 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1, k2, k3] v -> (acc, DeepMap '[k0, k1, k2, k3] w) -- | O(n). Like mapAccum but the function has access to the -- keys. mapAccumWithKey5 :: (acc -> k0 -> k1 -> k2 -> k3 -> k4 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1, k2, k3, k4] v -> (acc, DeepMap '[k0, k1, k2, k3, k4] w) -- | O(n). Like mapAccumR but the function has access to the -- keys. mapAccumRWithKey :: (acc -> k -> DeepMap ks v -> (acc, DeepMap ls w)) -> acc -> DeepMap (k ': ks) v -> (acc, DeepMap (k ': ls) w) -- | O(n). Like mapAccumR but the function has access to the -- keys. mapAccumRWithKey1 :: (acc -> k -> v -> (acc, w)) -> acc -> DeepMap '[k] v -> (acc, DeepMap '[k] w) -- | O(n). Like mapAccumR but the function has access to the -- keys. mapAccumRWithKey2 :: (acc -> k0 -> k1 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1] v -> (acc, DeepMap '[k0, k1] w) -- | O(n). Like mapAccumR but the function has access to the -- keys. mapAccumRWithKey3 :: (acc -> k0 -> k1 -> k2 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1, k2] v -> (acc, DeepMap '[k0, k1, k2] w) -- | O(n). Like mapAccumR but the function has access to the -- keys. mapAccumRWithKey4 :: (acc -> k0 -> k1 -> k2 -> k3 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1, k2, k3] v -> (acc, DeepMap '[k0, k1, k2, k3] w) -- | O(n). Like mapAccumR but the function has access to the -- keys. mapAccumRWithKey5 :: (acc -> k0 -> k1 -> k2 -> k3 -> k4 -> v -> (acc, w)) -> acc -> DeepMap '[k0, k1, k2, k3, k4] v -> (acc, DeepMap '[k0, k1, k2, k3, k4] w) -- | O(n log n). Map a function over the outer keys of a -- DeepMap. If the function maps two or more j-keys to -- the same k-key, the values of the j-keys are -- combined with (<>). -- -- To retain Map's greatest-biased functionality, use -- mapKeysWith const. mapKeys :: (Ord k, Semigroup (DeepMap ks v)) => (j -> k) -> DeepMap (j ': ks) v -> DeepMap (k ': ks) v mapKeysDeep :: Monoid (DeepMap ks v) => (Deep js -> Deep ks) -> DeepMap js v -> DeepMap ks v -- | O(n log n). Map a function over the keys of a DeepMap. mapKeys1 :: (Ord k, Semigroup v) => (j -> k) -> DeepMap '[j] v -> DeepMap '[k] v -- | O(n log n). Map a function over the keys of a DeepMap. mapKeys2 :: (Ord k0, Ord k1, Semigroup (DeepMap ks v)) => (j0 -> k0) -> (j1 -> k1) -> DeepMap (j0 ': (j1 ': ks)) v -> DeepMap (k0 ': (k1 ': ks)) v -- | O(n log n). Map a function over the keys of a DeepMap. mapKeys3 :: (Ord k0, Ord k1, Ord k2, Semigroup (DeepMap ks v)) => (j0 -> k0) -> (j1 -> k1) -> (j2 -> k2) -> DeepMap (j0 ': (j1 ': (j2 ': ks))) v -> DeepMap (k0 ': (k1 ': (k2 ': ks))) v -- | O(n log n). Map a function over the keys of a DeepMap. mapKeys4 :: (Ord k0, Ord k1, Ord k2, Ord k3, Semigroup (DeepMap ks v)) => (j0 -> k0) -> (j1 -> k1) -> (j2 -> k2) -> (j3 -> k3) -> DeepMap (j0 ': (j1 ': (j2 ': (j3 ': ks)))) v -> DeepMap (k0 ': (k1 ': (k2 ': (k3 ': ks)))) v -- | O(n log n). Map a function over the keys of a DeepMap. mapKeys5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4, Semigroup (DeepMap ks v)) => (j0 -> k0) -> (j1 -> k1) -> (j2 -> k2) -> (j3 -> k3) -> (j4 -> k4) -> DeepMap (j0 ': (j1 ': (j2 ': (j3 ': (j4 ': ks))))) v -> DeepMap (k0 ': (k1 ': (k2 ': (k3 ': (k4 ': ks))))) v -- | O(n log n). Map a function over the outer keys of a -- DeepMap with a combining function. mapKeysWith :: Ord k => (DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> (j -> k) -> DeepMap (j ': ks) v -> DeepMap (k ': ks) v -- | O(n log n). Map a function over the keys of a DeepMap -- with a value-combining function. mapKeysWith1 :: Ord k => (v -> v -> v) -> (j -> k) -> DeepMap '[j] v -> DeepMap '[k] v -- | O(n log n). Map a function over the keys of a DeepMap -- with a value-combining function. mapKeysWith2 :: (Ord k0, Ord k1) => (v -> v -> v) -> (j0 -> k0) -> (j1 -> k1) -> DeepMap '[j0, j1] v -> DeepMap '[k0, k1] v -- | O(n log n). Map a function over the keys of a DeepMap -- with a value-combining function. mapKeysWith3 :: (Ord k0, Ord k1, Ord k2) => (v -> v -> v) -> (j0 -> k0) -> (j1 -> k1) -> (j2 -> k2) -> DeepMap '[j0, j1, j2] v -> DeepMap '[k0, k1, k2] v -- | O(n log n). Map a function over the keys of a DeepMap -- with a value-combining function. mapKeysWith4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => (v -> v -> v) -> (j0 -> k0) -> (j1 -> k1) -> (j2 -> k2) -> (j3 -> k3) -> DeepMap '[j0, j1, j2, j3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(n log n). Map a function over the keys of a DeepMap -- with a value-combining function. mapKeysWith5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (v -> v -> v) -> (j0 -> k0) -> (j1 -> k1) -> (j2 -> k2) -> (j3 -> k3) -> (j4 -> k4) -> DeepMap '[j0, j1, j2, j3, j4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(n log n). Map an applicative function over the outer keys and -- collect the results. traverseKeys :: (Applicative f, Ord k, Semigroup (DeepMap ks v)) => (j -> f k) -> DeepMap (j ': ks) v -> f (DeepMap (k ': ks) v) traverseKeysDeep :: forall f js ks v. (Applicative f, Monoid (DeepMap ks v)) => (Deep js -> f (Deep ks)) -> DeepMap js v -> f (DeepMap ks v) -- | O(n log n). Map an applicative function over the outer keys of -- the map and collect the results using the specified combining -- function. traverseKeysWith :: (Applicative f, Ord k) => (DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> (j -> f k) -> DeepMap (j ': ks) v -> f (DeepMap (k ': ks) v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap and collect the results. mapKeysM :: (Monad m, Ord k, Semigroup (DeepMap ks v)) => (j -> m k) -> DeepMap (j ': ks) v -> m (DeepMap (k ': ks) v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap and collect the results. mapKeysM1 :: (Monad m, Ord k, Semigroup (DeepMap ks v)) => (j -> m k) -> DeepMap (j ': ks) v -> m (DeepMap (k ': ks) v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap and collect the results. -- -- Sadly traverseKeys2 can't have this type signature because -- we'd end up with a twice-wrapped Applicative and no way out. mapKeysM2 :: (Monad m, Ord k0, Ord k1, Semigroup (DeepMap ks v)) => (j0 -> m k0) -> (j1 -> m k1) -> DeepMap (j0 ': (j1 ': ks)) v -> m (DeepMap (k0 ': (k1 ': ks)) v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap and collect the results. mapKeysM3 :: (Monad m, Ord k0, Ord k1, Ord k2, Semigroup (DeepMap ks v)) => (j0 -> m k0) -> (j1 -> m k1) -> (j2 -> m k2) -> DeepMap (j0 ': (j1 ': (j2 ': ks))) v -> m (DeepMap (k0 ': (k1 ': (k2 ': ks))) v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap and collect the results. mapKeysM4 :: (Monad m, Ord k0, Ord k1, Ord k2, Ord k3, Semigroup (DeepMap ks v)) => (j0 -> m k0) -> (j1 -> m k1) -> (j2 -> m k2) -> (j3 -> m k3) -> DeepMap (j0 ': (j1 ': (j2 ': (j3 ': ks)))) v -> m (DeepMap (k0 ': (k1 ': (k2 ': (k3 ': ks)))) v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap and collect the results. mapKeysM5 :: (Monad m, Ord k0, Ord k1, Ord k2, Ord k3, Ord k4, Semigroup (DeepMap ks v)) => (j0 -> m k0) -> (j1 -> m k1) -> (j2 -> m k2) -> (j3 -> m k3) -> (j4 -> m k4) -> DeepMap (j0 ': (j1 ': (j2 ': (j3 ': (j4 ': ks))))) v -> m (DeepMap (k0 ': (k1 ': (k2 ': (k3 ': (k4 ': ks))))) v) -- | O(n log n). Map a monadic function over the outer keys of a -- DeepMap with a submap-combining function. mapKeysMWith :: (Monad m, Ord k) => (DeepMap ks v -> DeepMap ks v -> DeepMap ks v) -> (j -> m k) -> DeepMap (j ': ks) v -> m (DeepMap (k ': ks) v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap with a value-combining function. mapKeysMWith1 :: (Monad m, Ord k) => (v -> v -> v) -> (j -> m k) -> DeepMap '[j] v -> m (DeepMap '[k] v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap with a value-combining function. mapKeysMWith2 :: (Monad m, Ord k0, Ord k1) => (v -> v -> v) -> (j0 -> m k0) -> (j1 -> m k1) -> DeepMap '[j0, j1] v -> m (DeepMap '[k0, k1] v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap with a value-combining function. mapKeysMWith3 :: (Monad m, Ord k0, Ord k1, Ord k2) => (v -> v -> v) -> (j0 -> m k0) -> (j1 -> m k1) -> (j2 -> m k2) -> DeepMap '[j0, j1, j2] v -> m (DeepMap '[k0, k1, k2] v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap with a value-combining function. mapKeysMWith4 :: (Monad m, Ord k0, Ord k1, Ord k2, Ord k3) => (v -> v -> v) -> (j0 -> m k0) -> (j1 -> m k1) -> (j2 -> m k2) -> (j3 -> m k3) -> DeepMap '[j0, j1, j2, j3] v -> m (DeepMap '[k0, k1, k2, k3] v) -- | O(n log n). Map a monadic function over the keys of a -- DeepMap with a value-combining function. mapKeysMWith5 :: (Monad m, Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => (v -> v -> v) -> (j0 -> m k0) -> (j1 -> m k1) -> (j2 -> m k2) -> (j3 -> m k3) -> (j4 -> m k4) -> DeepMap '[j0, j1, j2, j3, j4] v -> m (DeepMap '[k0, k1, k2, k3, k4] v) -- | Right-associative fold of a structure, lazy in the accumulator. -- -- In the case of lists, foldr, when applied to a binary operator, -- a starting value (typically the right-identity of the operator), and a -- list, reduces the list using the binary operator, from right to left: -- --
-- foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...) ---- -- Note that since the head of the resulting expression is produced by an -- application of the operator to the first element of the list, given an -- operator lazy in its right argument, foldr can produce a -- terminating expression from an unbounded list. -- -- For a general Foldable structure this should be semantically -- identical to, -- --
-- foldr f z = foldr f z . toList ---- --
-- >>> foldr (||) False [False, True, False] -- True ---- --
-- >>> foldr (||) False [] -- False ---- --
-- >>> foldr (\c acc -> acc ++ [c]) "foo" ['a', 'b', 'c', 'd'] -- "foodcba" ---- --
-- >>> foldr (||) False (True : repeat False) -- True ---- -- But the following doesn't terminate: -- --
-- >>> foldr (||) False (repeat False ++ [True]) -- * Hangs forever * ---- --
-- >>> take 5 $ foldr (\i acc -> i : fmap (+3) acc) [] (repeat 1) -- [1,4,7,10,13] --foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b -- | Left-associative fold of a structure, lazy in the accumulator. This is -- rarely what you want, but can work well for structures with efficient -- right-to-left sequencing and an operator that is lazy in its left -- argument. -- -- In the case of lists, foldl, when applied to a binary operator, -- a starting value (typically the left-identity of the operator), and a -- list, reduces the list using the binary operator, from left to right: -- --
-- foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn ---- -- Note that to produce the outermost application of the operator the -- entire input list must be traversed. Like all left-associative folds, -- foldl will diverge if given an infinite list. -- -- If you want an efficient strict left-fold, you probably want to use -- foldl' instead of foldl. The reason for this is that the -- latter does not force the inner results (e.g. z `f` x1 -- in the above example) before applying them to the operator (e.g. to -- (`f` x2)). This results in a thunk chain O(n) elements -- long, which then must be evaluated from the outside-in. -- -- For a general Foldable structure this should be semantically -- identical to: -- --
-- foldl f z = foldl f z . toList ---- --
-- >>> foldl (+) 42 [1,2,3,4] -- 52 ---- -- Though the result below is lazy, the input is reversed before -- prepending it to the initial accumulator, so corecursion begins only -- after traversing the entire input string. -- --
-- >>> foldl (\acc c -> c : acc) "abcd" "efgh" -- "hgfeabcd" ---- -- A left fold of a structure that is infinite on the right cannot -- terminate, even when for any finite input the fold just returns the -- initial accumulator: -- --
-- >>> foldl (\a _ -> a) 0 $ repeat 1 -- * Hangs forever * ---- -- WARNING: When it comes to lists, you always want to use either -- foldl' or foldr instead. foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b foldShallow :: Monoid (DeepMap ks v) => DeepMap (k ': ks) v -> DeepMap ks v -- | O(n). Fold the keys and submaps in the DeepMap using the -- given right-associative binary operator. foldrWithKey :: (k -> DeepMap ks v -> b -> b) -> b -> DeepMap (k ': ks) v -> b -- | O(n). Fold the keys and values using the given -- right-associative binary operator. foldrWithKey1 :: (k -> v -> b -> b) -> b -> DeepMap '[k] v -> b -- | O(n). Fold the keys and values using the given -- right-associative binary operator. foldrWithKey2 :: (k0 -> k1 -> v -> b -> b) -> b -> DeepMap '[k0, k1] v -> b -- | O(n). Fold the keys and values using the given -- right-associative binary operator. foldrWithKey3 :: (k0 -> k1 -> k2 -> v -> b -> b) -> b -> DeepMap '[k0, k1, k2] v -> b -- | O(n). Fold the keys and values using the given -- right-associative binary operator. foldrWithKey4 :: (k0 -> k1 -> k2 -> k3 -> v -> b -> b) -> b -> DeepMap '[k0, k1, k2, k3] v -> b -- | O(n). Fold the keys and values using the given -- right-associative binary operator. foldrWithKey5 :: (k0 -> k1 -> k2 -> k3 -> k3 -> v -> b -> b) -> b -> DeepMap '[k0, k1, k2, k3, k3] v -> b -- | O(n). Fold the keys and submaps in the DeepMap using the -- given left-associative binary operator. foldlWithKey :: (b -> k -> DeepMap ks v -> b) -> b -> DeepMap (k ': ks) v -> b -- | O(n). Fold the keys and values in the DeepMap using the -- given left-associative binary operator. foldlWithKey1 :: (b -> k -> v -> b) -> b -> DeepMap '[k] v -> b -- | O(n). Fold the keys and values in the DeepMap using the -- given left-associative binary operator. foldlWithKey2 :: (b -> k0 -> k1 -> v -> b) -> b -> DeepMap '[k0, k1] v -> b -- | O(n). Fold the keys and values in the DeepMap using the -- given left-associative binary operator. foldlWithKey3 :: (b -> k0 -> k1 -> k2 -> v -> b) -> b -> DeepMap '[k0, k1, k2] v -> b -- | O(n). Fold the keys and values in the DeepMap using the -- given left-associative binary operator. foldlWithKey4 :: (b -> k0 -> k1 -> k2 -> k3 -> v -> b) -> b -> DeepMap '[k0, k1, k2, k3] v -> b -- | O(n). Strictly fold the keys and values in the DeepMap -- using the given left-associative binary operator. foldlWithKey5 :: (b -> k0 -> k1 -> k2 -> k3 -> k4 -> v -> b) -> b -> DeepMap '[k0, k1, k2, k3, k4] v -> b -- | O(n). Fold the keys and submaps using the given monoid. foldMapWithKey :: Monoid m => (k -> DeepMap ks v -> m) -> DeepMap (k ': ks) v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey1 :: Monoid m => (k -> v -> m) -> DeepMap '[k] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey2 :: Monoid m => (k0 -> k1 -> v -> m) -> DeepMap '[k0, k1] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey3 :: Monoid m => (k0 -> k1 -> k2 -> v -> m) -> DeepMap '[k0, k1, k2] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey4 :: Monoid m => (k0 -> k1 -> k2 -> k3 -> v -> m) -> DeepMap '[k0, k1, k2, k3] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey5 :: Monoid m => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> m) -> DeepMap '[k0, k1, k2, k3, k4] v -> m -- | foldr' is a variant of foldr that performs strict -- reduction from right to left, i.e. starting with the right-most -- element. The input structure must be finite, otherwise -- foldr' runs out of space (diverges). -- -- If you want a strict right fold in constant space, you need a -- structure that supports faster than O(n) access to the -- right-most element, such as Seq from the containers -- package. -- -- This method does not run in constant space for structures such as -- lists that don't support efficient right-to-left iteration and so -- require O(n) space to perform right-to-left reduction. Use of -- this method with such a structure is a hint that the chosen structure -- may be a poor fit for the task at hand. If the order in which the -- elements are combined is not important, use foldl' instead. foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b -- | Left-associative fold of a structure but with strict application of -- the operator. -- -- This ensures that each step of the fold is forced to Weak Head Normal -- Form before being applied, avoiding the collection of thunks that -- would otherwise occur. This is often what you want to strictly reduce -- a finite structure to a single strict result (e.g. sum). -- -- For a general Foldable structure this should be semantically -- identical to, -- --
-- foldl' f z = foldl' f z . toList --foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b -- | O(n). Strictly fold the keys and submaps in the DeepMap -- using the given right-associative binary operator. foldrWithKey' :: (k -> DeepMap ks v -> b -> b) -> b -> DeepMap (k ': ks) v -> b -- | O(n). Strictly fold the keys and values using the given -- right-associative binary operator. foldrWithKey1' :: (k -> v -> b -> b) -> b -> DeepMap '[k] v -> b -- | O(n). Strictly fold the keys and values using the given -- right-associative binary operator. foldrWithKey2' :: (k0 -> k1 -> v -> b -> b) -> b -> DeepMap '[k0, k1] v -> b -- | O(n). Strictly fold the keys and values using the given -- right-associative binary operator. foldrWithKey3' :: (k0 -> k1 -> k2 -> v -> b -> b) -> b -> DeepMap '[k0, k1, k2] v -> b -- | O(n). Strictly fold the keys and values using the given -- right-associative binary operator. foldrWithKey4' :: (k0 -> k1 -> k2 -> k3 -> v -> b -> b) -> b -> DeepMap '[k0, k1, k2, k3] v -> b -- | O(n). Strictly fold the keys and values using the given -- right-associative binary operator. foldrWithKey5' :: (k0 -> k1 -> k2 -> k3 -> k3 -> v -> b -> b) -> b -> DeepMap '[k0, k1, k2, k3, k3] v -> b -- | O(n). Strictly fold the keys and submaps in the DeepMap -- using the given left-associative binary operator. foldlWithKey' :: (b -> k -> DeepMap ks v -> b) -> b -> DeepMap (k ': ks) v -> b -- | O(n). Strictly fold the keys and values in the DeepMap -- using the given left-associative binary operator. foldlWithKey1' :: (b -> k -> v -> b) -> b -> DeepMap '[k] v -> b -- | O(n). Strictly fold the keys and values in the DeepMap -- using the given left-associative binary operator. foldlWithKey2' :: (b -> k0 -> k1 -> v -> b) -> b -> DeepMap '[k0, k1] v -> b -- | O(n). Strictly fold the keys and values in the DeepMap -- using the given left-associative binary operator. foldlWithKey3' :: (b -> k0 -> k1 -> k2 -> v -> b) -> b -> DeepMap '[k0, k1, k2] v -> b -- | O(n). Strictly fold the keys and values in the DeepMap -- using the given left-associative binary operator. foldlWithKey4' :: (b -> k0 -> k1 -> k2 -> k3 -> v -> b) -> b -> DeepMap '[k0, k1, k2, k3] v -> b -- | O(n). Fold the keys and values in the DeepMap using the -- given left-associative binary operator. foldlWithKey5' :: (b -> k0 -> k1 -> k2 -> k3 -> k4 -> v -> b) -> b -> DeepMap '[k0, k1, k2, k3, k4] v -> b -- | O(n). Fold the keys and submaps using the given monoid. foldMapWithKey' :: Monoid m => (k -> DeepMap ks v -> m) -> DeepMap (k ': ks) v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey1' :: Monoid m => (k -> v -> m) -> DeepMap '[k] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey2' :: Monoid m => (k0 -> k1 -> v -> m) -> DeepMap '[k0, k1] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey3' :: Monoid m => (k0 -> k1 -> k2 -> v -> m) -> DeepMap '[k0, k1, k2] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey4' :: Monoid m => (k0 -> k1 -> k2 -> k3 -> v -> m) -> DeepMap '[k0, k1, k2, k3] v -> m -- | O(n). Fold the keys and values in the map using the given -- monoid. foldMapWithKey5' :: Monoid m => (k0 -> k1 -> k2 -> k3 -> k4 -> v -> m) -> DeepMap '[k0, k1, k2, k3, k4] v -> m -- | O(n). Return all submaps of the map in ascending order of its -- keys. Subject to list fusion. elems :: DeepMap (k ': ks) v -> [DeepMap ks v] -- | O(n). Return all values of the singly-nested map in ascending -- order of its keys. Subject to list fusion. elems1 :: DeepMap '[k] v -> [v] -- | O(n). Return all values of the DeepMap at distinct key -- chains. elemsDeep :: DeepMap ks v -> [v] -- | O(n). Return all keys of the map in ascending order. Subject to -- list fusion. keys :: DeepMap (k ': ks) v -> [k] -- | O(n). The set of all keys of the map. keysSet :: DeepMap (k ': ks) v -> Set k -- | O(n). Return all distinct key chains of the DeepMap. keysDeep :: DeepMap ks v -> [Deep ks] -- | O(n). Return all pairs of the map in ascending key order. -- Subject to list fusion. assocs :: DeepMap (k ': ks) v -> [(k, DeepMap ks v)] -- | O(n). Return all pairs of the singly-nested map in ascending -- key order. Subject to list fusion. assocs1 :: DeepMap '[k] v -> [(k, v)] -- | O(n). Return all keychain-value pairs of the DeepMap. assocsDeep :: DeepMap ks v -> [(Deep ks, v)] -- | Transpose a DeepMap, by swapping the outer two -- "dimensions". invertKeys :: (Ord j, Ord k, Semigroup (DeepMap ks v)) => DeepMap (j ': (k ': ks)) v -> DeepMap (k ': (j ': ks)) v -- | List of elements of a structure, from left to right. If the entire -- list is intended to be reduced via a fold, just fold the structure -- directly bypassing the list. -- --
-- >>> toList Nothing -- [] ---- --
-- >>> toList (Just 42) -- [42] ---- --
-- >>> toList (Left "foo") -- [] ---- --
-- >>> toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8))) -- [5,17,12,8] ---- -- For lists, toList is the identity: -- --
-- >>> toList [1, 2, 3] -- [1,2,3] --toList :: Foldable t => t a -> [a] -- | O(n). Convert the map to a list of key/submap pairs where the -- keys are in ascending order. Subject to list fusion. toAscList :: DeepMap (k ': ks) v -> [(k, DeepMap ks v)] -- | O(n). Convert the map to a list of key/submap pairs where the -- keys are in descending order. Subject to list fusion. toDescList :: DeepMap (k ': ks) v -> [(k, DeepMap ks v)] -- | O(n). Filter all submaps that satisfy the predicate. filter :: (DeepMap ks v -> Bool) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(n). Filter all values that satisfy the predicate. filter1 :: (v -> Bool) -> DeepMap '[k] v -> DeepMap '[k] v -- | O(n). Filter all values that satisfy the predicate. filter2 :: (v -> Bool) -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(n). Filter all values that satisfy the predicate. filter3 :: (v -> Bool) -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(n). Filter all values that satisfy the predicate. filter4 :: (v -> Bool) -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(n). Filter all values that satisfy the predicate. filter5 :: (v -> Bool) -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(n). Filter all key/submap pairs that satisfy the predicate. filterWithKey :: (k -> DeepMap ks v -> Bool) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v filterWithKeys :: (Deep (k ': ks) -> v -> Bool) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(n). Filter all key/value pairs that satisfy the predicate. filterWithKey1 :: (k -> v -> Bool) -> DeepMap '[k] v -> DeepMap '[k] v -- | O(n). Filter all key-chain/value pairs that satisfy the -- predicate. filterWithKey2 :: (k0 -> k1 -> v -> Bool) -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] v -- | O(n). Filter all key-chain/value pairs that satisfy the -- predicate. filterWithKey3 :: (k0 -> k1 -> k2 -> v -> Bool) -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] v -- | O(n). Filter all key-chain/value pairs that satisfy the -- predicate. filterWithKey4 :: (k0 -> k1 -> k2 -> k3 -> v -> Bool) -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] v -- | O(n). Filter all key-chain/value pairs that satisfy the -- predicate. filterWithKey5 :: (k0 -> k1 -> k2 -> k3 -> k4 -> v -> Bool) -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] v -- | O(m log(n / m + 1)), m <= n. Restrict a Map to only -- the keys in a given Set. restrictKeys :: Ord k => DeepMap (k ': ks) v -> Set k -> DeepMap (k ': ks) v -- | O(m log(n / m + 1)), m <= n. Restrict a Map to only -- the keys in a given Set. restrictKeys2 :: (Ord k0, Ord k1) => DeepMap (k0 ': (k1 ': ks)) v -> Set (k0, k1) -> DeepMap (k0 ': (k1 ': ks)) v -- | O(m log(n / m + 1)), m <= n. Restrict a Map to only -- the keys in a given Set. restrictKeys3 :: (Ord k0, Ord k1, Ord k2) => DeepMap (k0 ': (k1 ': (k2 ': ks))) v -> Set (k0, k1, k2) -> DeepMap (k0 ': (k1 ': (k2 ': ks))) v -- | O(m log(n / m + 1)), m <= n. Restrict a Map to only -- the keys in a given Set. restrictKeys4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => DeepMap (k0 ': (k1 ': (k2 ': (k3 ': ks)))) v -> Set (k0, k1, k2, k3) -> DeepMap (k0 ': (k1 ': (k2 ': (k3 ': ks)))) v -- | O(m log(n / m + 1)), m <= n. Restrict a Map to only -- the keys in a given Set. restrictKeys5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => DeepMap (k0 ': (k1 ': (k2 ': (k3 ': (k4 ': ks))))) v -> Set (k0, k1, k2, k3, k4) -> DeepMap (k0 ': (k1 ': (k2 ': (k3 ': (k4 ': ks))))) v -- | O(m log(n / m + 1)), m <= n. Remove all the keys in a -- Set from a Map. withoutKeys :: Ord k => DeepMap (k ': ks) v -> Set k -> DeepMap (k ': ks) v -- | O(m log(n / m + 1)), m <= n. Remove all the keys in a -- Set from a Map. withoutKeys2 :: (Ord k0, Ord k1) => DeepMap (k0 ': (k1 ': ks)) v -> Set (k0, k1) -> DeepMap (k0 ': (k1 ': ks)) v -- | O(m log(n / m + 1)), m <= n. Remove all the keys in a -- Set from a Map. withoutKeys3 :: (Ord k0, Ord k1, Ord k2) => DeepMap (k0 ': (k1 ': (k2 ': ks))) v -> Set (k0, k1, k2) -> DeepMap (k0 ': (k1 ': (k2 ': ks))) v -- | O(m log(n / m + 1)), m <= n. Remove all the keys in a -- Set from a Map. withoutKeys4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => DeepMap (k0 ': (k1 ': (k2 ': (k3 ': ks)))) v -> Set (k0, k1, k2, k3) -> DeepMap (k0 ': (k1 ': (k2 ': (k3 ': ks)))) v -- | O(m log(n / m + 1)), m <= n. Remove all the keys in a -- Set from a Map. withoutKeys5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => DeepMap (k0 ': (k1 ': (k2 ': (k3 ': (k4 ': ks))))) v -> Set (k0, k1, k2, k3, k4) -> DeepMap (k0 ': (k1 ': (k2 ': (k3 ': (k4 ': ks))))) v -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partition :: (DeepMap ks v -> Bool) -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) v, DeepMap (k ': ks) v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partition1 :: (v -> Bool) -> DeepMap '[k] v -> (DeepMap '[k] v, DeepMap '[k] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partition2 :: (v -> Bool) -> DeepMap '[k0, k1] v -> (DeepMap '[k0, k1] v, DeepMap '[k0, k1] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partition3 :: (v -> Bool) -> DeepMap '[k0, k1, k2] v -> (DeepMap '[k0, k1, k2] v, DeepMap '[k0, k1, k2] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partition4 :: (v -> Bool) -> DeepMap '[k0, k1, k2, k3] v -> (DeepMap '[k0, k1, k2, k3] v, DeepMap '[k0, k1, k2, k3] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partition5 :: (v -> Bool) -> DeepMap '[k0, k1, k2, k3, k4] v -> (DeepMap '[k0, k1, k2, k3, k4] v, DeepMap '[k0, k1, k2, k3, k4] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partitionWithKey :: (k -> DeepMap ks v -> Bool) -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) v, DeepMap (k ': ks) v) partitionWithKeys :: (Deep (k ': ks) -> v -> Bool) -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) v, DeepMap (k ': ks) v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partitionWithKey1 :: (k -> v -> Bool) -> DeepMap '[k] v -> (DeepMap '[k] v, DeepMap '[k] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partitionWithKey2 :: (k0 -> k1 -> v -> Bool) -> DeepMap '[k0, k1] v -> (DeepMap '[k0, k1] v, DeepMap '[k0, k1] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partitionWithKey3 :: (k0 -> k1 -> k2 -> v -> Bool) -> DeepMap '[k0, k1, k2] v -> (DeepMap '[k0, k1, k2] v, DeepMap '[k0, k1, k2] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partitionWithKey4 :: (k0 -> k1 -> k2 -> k3 -> v -> Bool) -> DeepMap '[k0, k1, k2, k3] v -> (DeepMap '[k0, k1, k2, k3] v, DeepMap '[k0, k1, k2, k3] v) -- | O(n). Partition the map according to a predicate (satisfied, -- failed). partitionWithKey5 :: (k0 -> k1 -> k2 -> k3 -> k4 -> v -> Bool) -> DeepMap '[k0, k1, k2, k3, k4] v -> (DeepMap '[k0, k1, k2, k3, k4] v, DeepMap '[k0, k1, k2, k3, k4] v) -- | O(n). Take while a predicate on the keys holds. See the note at -- spanAntitone. takeWhileAntitone :: (k -> Bool) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(n). Drop while a predicate on the keys holds. See the note at -- spanAntitone. dropWhileAntitone :: (k -> Bool) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -- | O(n). Take while a predicate on the keys holds. -- -- NOTE: if p is not actually antitone, then spanAntitone -- will split the map at some unspecified point where the predicate -- switches from holding to not holding (where the predicate is seen to -- hold before the first key and to fail after the last key). spanAntitone :: (k -> Bool) -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) v, DeepMap (k ': ks) v) -- | O(n). Map values and collect the Just results. mapMaybe :: (v -> Maybe w) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) w mapMaybeWithKeys :: (Deep (k ': ks) -> a -> Maybe b) -> DeepMap (k ': ks) a -> DeepMap (k ': ks) b -- | O(n). Map values and collect the Just results. Strictly -- more general than mapMaybe in that the types of the inner keys -- can change. mapShallowMaybe :: (DeepMap ks v -> Maybe (DeepMap ls w)) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -- | O(n). Map values and collect the Just results. mapShallowMaybeWithKey :: (k -> DeepMap ks v -> Maybe (DeepMap ls w)) -> DeepMap (k ': ks) v -> DeepMap (k ': ls) w -- | O(n). Map values and collect the Just results. mapMaybeWithKey1 :: (k -> v -> Maybe w) -> DeepMap '[k] v -> DeepMap '[k] w -- | O(n). Map values and collect the Just results. mapMaybeWithKey2 :: (k0 -> k1 -> v -> Maybe w) -> DeepMap '[k0, k1] v -> DeepMap '[k0, k1] w -- | O(n). Map values and collect the Just results. mapMaybeWithKey3 :: (k0 -> k1 -> k2 -> v -> Maybe w) -> DeepMap '[k0, k1, k2] v -> DeepMap '[k0, k1, k2] w -- | O(n). Map values and collect the Just results. mapMaybeWithKey4 :: (k0 -> k1 -> k2 -> k3 -> v -> Maybe w) -> DeepMap '[k0, k1, k2, k3] v -> DeepMap '[k0, k1, k2, k3] w -- | O(n). Map values and collect the Just results. mapMaybeWithKey5 :: (k0 -> k1 -> k2 -> k3 -> k4 -> v -> Maybe w) -> DeepMap '[k0, k1, k2, k3, k4] v -> DeepMap '[k0, k1, k2, k3, k4] w -- | O(n). Map values and collect the Left and Right -- results separately. mapEither :: (v -> Either w x) -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) w, DeepMap (k ': ks) x) mapEitherWithKeys :: (Deep (k ': ks) -> v -> Either w x) -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) w, DeepMap (k ': ks) x) -- | O(n). Map values and collect the Left and Right -- results separately. mapShallowEither :: (DeepMap ks v -> Either (DeepMap ls w) (DeepMap ms x)) -> DeepMap (k ': ks) v -> (DeepMap (k ': ls) w, DeepMap (k ': ms) x) -- | O(n). Map values and collect the Left and Right -- results separately. mapShallowEitherWithKey :: (k -> DeepMap ks v -> Either (DeepMap ls w) (DeepMap ms x)) -> DeepMap (k ': ks) v -> (DeepMap (k ': ls) w, DeepMap (k ': ms) x) -- | O(n). Map values and collect the Left and Right -- results separately. mapEitherWithKey1 :: (k -> v -> Either w x) -> DeepMap '[k] v -> (DeepMap '[k] w, DeepMap '[k] x) -- | O(n). Map values and collect the Left and Right -- results separately. mapEitherWithKey2 :: (k0 -> k1 -> v -> Either w x) -> DeepMap '[k0, k1] v -> (DeepMap '[k0, k1] w, DeepMap '[k0, k1] x) -- | O(n). Map values and collect the Left and Right -- results separately. mapEitherWithKey3 :: (k0 -> k1 -> k2 -> v -> Either w x) -> DeepMap '[k0, k1, k2] v -> (DeepMap '[k0, k1, k2] w, DeepMap '[k0, k1, k2] x) -- | O(n). Map values and collect the Left and Right -- results separately. mapEitherWithKey4 :: (k0 -> k1 -> k2 -> k3 -> v -> Either w x) -> DeepMap '[k0, k1, k2, k3] v -> (DeepMap '[k0, k1, k2, k3] w, DeepMap '[k0, k1, k2, k3] x) -- | O(n). Map values and collect the Left and Right -- results separately. mapEitherWithKey5 :: (k0 -> k1 -> k2 -> k3 -> k4 -> v -> Either w x) -> DeepMap '[k0, k1, k2, k3, k4] v -> (DeepMap '[k0, k1, k2, k3, k4] w, DeepMap '[k0, k1, k2, k3, k4] x) -- | O(log n). Partition the map by comparing keys ((smaller, -- larger) than given). split :: Ord k => k -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) v, DeepMap (k ': ks) v) -- | O(log n). Like split but the middle coordinate -- lookups the value at the key. splitLookup :: Ord k => k -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) v, Maybe (DeepMap ks v), DeepMap (k ': ks) v) -- | O(1). Decompose a map into pieces based on the structure of the -- underlying tree. splitRoot :: DeepMap (k ': ks) v -> [DeepMap (k ': ks) v] -- | O(m log(n / m + 1)), m <= n. Returns True if all the -- keys in the left map exist in the right, and their values all -- agree. isSubmapOf :: (Ord k, Eq (DeepMap ks v)) => DeepMap (k ': ks) v -> DeepMap (k ': ks) v -> Bool -- | O(m log(n / m + 1)), m <= n. Returns True if all the -- keys in the left map exist in the right, and the function -- returns True when applied to respective values. isSubmapOfBy :: Ord k => (DeepMap ks v -> DeepMap ks v -> Bool) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -> Bool -- | O(m log(n / m + 1)), m <= n. Returns True if all the -- keys in the left map exist in the right, and their values all -- agree, and the maps are not equal. isProperSubmapOf :: (Ord k, Eq (DeepMap ks v)) => DeepMap (k ': ks) v -> DeepMap (k ': ks) v -> Bool -- | O(m log(n / m + 1)), m <= n. Returns True if all the -- keys in the left map exist in the right, and the function -- returns True when applied to respective values, and the -- maps are not equal. isProperSubmapOfBy :: Ord k => (DeepMap ks v -> DeepMap ks v -> Bool) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v -> Bool -- | O(log n). Lookup the index of a key, which is its -- zero-based index in the ordered sequence of keys. -- --
-- 'lookupIndex' k m == 'Data.List.findIndex' k ('keys' m)
--
lookupIndex :: Ord k => k -> DeepMap (k ': ks) v -> Maybe Int
-- | O(log n). Lookup the index of a key, which is its
-- zero-based index in the ordered sequence of keys. Calls error
-- when the key is not in the map.
findIndex :: Ord k => k -> DeepMap (k ': ks) v -> Int
-- | O(log n). Retrieve an element by its index. Calls
-- error if i is outside the range 0 <= i <
-- size m.
elemAt :: Ord k => Int -> DeepMap (k ': ks) v -> (k, DeepMap ks v)
-- | O(log n). Update the element by its index. Calls
-- error if i is outside the range 0 <= i <
-- size m.
updateAt :: Ord k => (k -> DeepMap ks v -> Maybe (DeepMap ks v)) -> Int -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Delete the element by its index. Calls
-- error if i is outside the range 0 <= i <
-- size m.
deleteAt :: Ord k => (k -> DeepMap ks v -> Maybe (DeepMap ks v)) -> Int -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | Take the smallest n keys.
take :: Int -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | Drop the smallest n keys.
drop :: Int -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(n). Split a map at a particular index.
splitAt :: Int -> DeepMap (k ': ks) v -> (DeepMap (k ': ks) v, DeepMap (k ': ks) v)
-- | O(log n). The minimal key of the map, or Nothing if the
-- map is empty.
lookupMin :: DeepMap (k ': ks) v -> Maybe (k, DeepMap ks v)
-- | O(log n). The maximal key of the map, or Nothing if the
-- map is empty.
lookupMax :: DeepMap (k ': ks) v -> Maybe (k, DeepMap ks v)
-- | O(log n). The minimal key of the map, or error if the
-- map is empty.
findMin :: DeepMap (k ': ks) v -> (k, DeepMap ks v)
-- | O(log n). The maximal key of the map, or error if the
-- map is empty.
findMax :: DeepMap (k ': ks) v -> (k, DeepMap ks v)
-- | O(log n). Delete the minimal key.
deleteMin :: DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Delete the maximal key.
deleteMax :: DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Delete and return the minimal key of the map, or
-- error if the map is empty.
deleteFindMin :: DeepMap (k ': ks) v -> ((k, DeepMap ks v), DeepMap (k ': ks) v)
-- | O(log n). Delete and return the maximal key of the map, or
-- error if the map is empty.
deleteFindMax :: DeepMap (k ': ks) v -> ((k, DeepMap ks v), DeepMap (k ': ks) v)
-- | O(log n). Update the value at the minimal key.
updateMin :: (DeepMap ks v -> Maybe (DeepMap ks v)) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Update the value at the maximal key.
updateMax :: (DeepMap ks v -> Maybe (DeepMap ks v)) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Update the value at the minimal key.
updateMinWithKey :: (k -> DeepMap ks v -> Maybe (DeepMap ks v)) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Update the value at the maximal key.
updateMaxWithKey :: (k -> DeepMap ks v -> Maybe (DeepMap ks v)) -> DeepMap (k ': ks) v -> DeepMap (k ': ks) v
-- | O(log n). Retrieve the value associated with the minimal key of
-- the map, and the map stripped of that element, or Nothing if
-- passed an empty map.
minView :: DeepMap (k ': ks) v -> Maybe (DeepMap ks v, DeepMap (k ': ks) v)
-- | O(log n). Retrieve the value associated with the maximal key of
-- the map, and the map stripped of that element, or Nothing if
-- passed an empty map.
maxView :: DeepMap (k ': ks) v -> Maybe (DeepMap ks v, DeepMap (k ': ks) v)
-- | O(log n). Retrieve the minimal key/value pair of the map, and
-- the map stripped of that element, or Nothing if passed an empty
-- map.
minViewWithKey :: DeepMap (k ': ks) v -> Maybe ((k, DeepMap ks v), DeepMap (k ': ks) v)
-- | O(log n). Retrieve the maximal key/value pair of the map, and
-- the map stripped of that element, or Nothing if passed an empty
-- map.
maxViewWithKey :: DeepMap (k ': ks) v -> Maybe ((k, DeepMap ks v), DeepMap (k ': ks) v)
-- | For use with indexed maps, folds, and traversals.
data Deep ks
pattern D1 :: () => k -> Deep ks -> Deep (k ': ks)
pattern D2 :: (Ord k0, Ord k1) => k0 -> k1 -> Deep ks -> Deep (k0 ': (k1 ': ks))
pattern D3 :: (Ord k0, Ord k1, Ord k2) => k0 -> k1 -> k2 -> Deep ks -> Deep (k0 ': (k1 ': (k2 ': ks)))
pattern D4 :: (Ord k0, Ord k1, Ord k2, Ord k3) => k0 -> k1 -> k2 -> k3 -> Deep ks -> Deep (k0 ': (k1 ': (k2 ': (k3 ': ks))))
pattern D5 :: (Ord k0, Ord k1, Ord k2, Ord k3, Ord k4) => k0 -> k1 -> k2 -> k3 -> k4 -> Deep ks -> Deep (k0 ': (k1 ': (k2 ': (k3 ': (k4 ': ks)))))
instance GHC.Base.Functor (Data.Map.Deep.DeepMap ks)
instance Data.Foldable.Foldable (Data.Map.Deep.DeepMap ks)
instance Data.Traversable.Traversable (Data.Map.Deep.DeepMap ks)
instance GHC.Classes.Eq (Data.Map.Deep.Deep '[])
instance GHC.Classes.Ord (Data.Map.Deep.Deep '[])
instance GHC.Show.Show (Data.Map.Deep.Deep '[])
instance (GHC.Classes.Eq k, GHC.Classes.Eq (Data.Map.Deep.Deep ks)) => GHC.Classes.Eq (Data.Map.Deep.Deep (k : ks))
instance (GHC.Classes.Ord k, GHC.Classes.Ord (Data.Map.Deep.Deep ks)) => GHC.Classes.Ord (Data.Map.Deep.Deep (k : ks))
instance (GHC.Show.Show k, GHC.Show.Show (Data.Map.Deep.Deep ks)) => GHC.Show.Show (Data.Map.Deep.Deep (k : ks))
instance WithIndex.FunctorWithIndex (Data.Map.Deep.Deep ks) (Data.Map.Deep.DeepMap ks)
instance WithIndex.FoldableWithIndex (Data.Map.Deep.Deep ks) (Data.Map.Deep.DeepMap ks)
instance WithIndex.TraversableWithIndex (Data.Map.Deep.Deep ks) (Data.Map.Deep.DeepMap ks)
instance Witherable.FilterableWithIndex (Data.Map.Deep.Deep ks) (Data.Map.Deep.DeepMap ks)
instance Witherable.WitherableWithIndex (Data.Map.Deep.Deep ks) (Data.Map.Deep.DeepMap ks)
instance GHC.Classes.Eq v => GHC.Classes.Eq (Data.Map.Deep.DeepMap '[] v)
instance (GHC.Classes.Eq k, GHC.Classes.Eq (Data.Map.Deep.DeepMap ks v)) => GHC.Classes.Eq (Data.Map.Deep.DeepMap (k : ks) v)
instance GHC.Classes.Ord v => GHC.Classes.Ord (Data.Map.Deep.DeepMap '[] v)
instance (GHC.Classes.Ord k, GHC.Classes.Ord (Data.Map.Deep.DeepMap ks v)) => GHC.Classes.Ord (Data.Map.Deep.DeepMap (k : ks) v)
instance GHC.Show.Show v => GHC.Show.Show (Data.Map.Deep.DeepMap '[] v)
instance (GHC.Show.Show k, GHC.Show.Show (Data.Map.Deep.DeepMap ks v)) => GHC.Show.Show (Data.Map.Deep.DeepMap (k : ks) v)
instance GHC.Base.Semigroup v => GHC.Base.Semigroup (Data.Map.Deep.DeepMap '[] v)
instance (GHC.Classes.Ord k, GHC.Base.Semigroup (Data.Map.Deep.DeepMap ks v)) => GHC.Base.Semigroup (Data.Map.Deep.DeepMap (k : ks) v)
instance GHC.Base.Monoid v => GHC.Base.Monoid (Data.Map.Deep.DeepMap '[] v)
instance (GHC.Classes.Ord k, GHC.Base.Semigroup (Data.Map.Deep.DeepMap ks v)) => GHC.Base.Monoid (Data.Map.Deep.DeepMap (k : ks) v)
instance Witherable.Filterable (Data.Map.Deep.DeepMap ks)
instance Witherable.Witherable (Data.Map.Deep.DeepMap ks)
instance Data.Data.Data v => Data.Data.Data (Data.Map.Deep.DeepMap '[] v)
instance (GHC.Classes.Ord k, Data.Data.Data k, Data.Typeable.Internal.Typeable ks, Data.Typeable.Internal.Typeable v, Data.Data.Data (Data.Map.Deep.DeepMap ks v)) => Data.Data.Data (Data.Map.Deep.DeepMap (k : ks) v)
instance GHC.Generics.Generic v => GHC.Generics.Generic (Data.Map.Deep.DeepMap '[] v)
instance (GHC.Classes.Ord k, GHC.Generics.Generic k, GHC.Generics.Generic (Data.Map.Deep.DeepMap ks v)) => GHC.Generics.Generic (Data.Map.Deep.DeepMap (k : ks) v)