Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Dependent.Map.Monoidal
Synopsis
- newtype MonoidalDMap (f :: k -> Type) (g :: k -> Type) = MonoidalDMap {
- unMonoidalDMap :: DMap f g
- newtype FakeDSum (f :: k -> Type) (g :: k -> Type) = FakeDSum {
- unFakeDSum :: DSum f g
- empty :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f
- singleton :: forall {k1} k2 (v :: k1) f. k2 v -> f v -> MonoidalDMap k2 f
- null :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Bool
- size :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Int
- lookup :: forall {k1} k2 f (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Maybe (f v)
- deleteFindMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> (DSum k2 f, MonoidalDMap k2 f)
- minViewWithKey :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f, MonoidalDMap k2 f)
- maxViewWithKey :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f, MonoidalDMap k2 f)
- deleteFindMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> (DSum k2 f, MonoidalDMap k2 f)
- member :: forall {k1} k2 (a :: k1) (f :: k1 -> Type). GCompare k2 => k2 a -> MonoidalDMap k2 f -> Bool
- notMember :: forall {k1} k2 (v :: k1) (f :: k1 -> Type). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Bool
- find :: forall {k1} k2 (v :: k1) f. GCompare k2 => k2 v -> MonoidalDMap k2 f -> f v
- findWithDefault :: forall {k1} k2 f (v :: k1). GCompare k2 => f v -> k2 v -> MonoidalDMap k2 f -> f v
- insert :: forall {k1} k2 f (v :: k1). GCompare k2 => k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- insertWith :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- insertWith' :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- insertWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- insertWithKey' :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- insertLookupWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> (Maybe (f v), MonoidalDMap k2 f)
- insertLookupWithKey' :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> (Maybe (f v), MonoidalDMap k2 f)
- delete :: forall {k1} k2 (f :: k1 -> Type) (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- adjust :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> f v) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- adjustWithKey :: forall {k1} k2 (v :: k1) f. GCompare k2 => (k2 v -> f v -> f v) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- adjustWithKey' :: forall {k1} k2 (v :: k1) f. GCompare k2 => (k2 v -> f v -> f v) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- update :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- updateWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- updateLookupWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> (Maybe (f v), MonoidalDMap k2 f)
- alter :: forall {k1} k2 f (v :: k1). GCompare k2 => (Maybe (f v) -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- findIndex :: forall {k1} k2 (v :: k1) (f :: k1 -> Type). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Int
- lookupIndex :: forall {k1} k2 (f :: k1 -> Type) (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Maybe Int
- elemAt :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). Int -> MonoidalDMap k2 f -> DSum k2 f
- updateAt :: (forall (v :: k1). k2 v -> f v -> Maybe (f v)) -> Int -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- deleteAt :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). Int -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- findMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> DSum k2 f
- lookupMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f)
- findMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> DSum k2 f
- lookupMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f)
- deleteMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> MonoidalDMap k2 f
- deleteMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> MonoidalDMap k2 f
- updateMinWithKey :: (forall (v :: k1). k2 v -> f v -> Maybe (f v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- updateMaxWithKey :: (forall (v :: k1). k2 v -> f v -> Maybe (f v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- unionsWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> [MonoidalDMap k2 f] -> MonoidalDMap k2 f
- unionWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> MonoidalDMap k2 f -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- difference :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type) (g :: k1 -> Type). GCompare k2 => MonoidalDMap k2 f -> MonoidalDMap k2 g -> MonoidalDMap k2 f
- differenceWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> g v -> Maybe (f v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> MonoidalDMap k2 f
- intersectionWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> g v -> h v) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> MonoidalDMap k2 h
- isSubmapOf :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). (GCompare k2, Has' Eq k2 f) => MonoidalDMap k2 f -> MonoidalDMap k2 f -> Bool
- isSubmapOfBy :: GCompare k2 => (forall (v :: k1). k2 v -> k2 v -> f v -> g v -> Bool) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> Bool
- isProperSubmapOf :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). (GCompare k2, Has' Eq k2 f) => MonoidalDMap k2 f -> MonoidalDMap k2 f -> Bool
- isProperSubmapOfBy :: GCompare k2 => (forall (v :: k1). k2 v -> k2 v -> f v -> g v -> Bool) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> Bool
- filterWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Bool) -> MonoidalDMap k2 f -> MonoidalDMap k2 f
- partitionWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Bool) -> MonoidalDMap k2 f -> (MonoidalDMap k2 f, MonoidalDMap k2 f)
- mapMaybeWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Maybe (g v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 g
- mapEitherWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Either (g v) (h v)) -> MonoidalDMap k2 f -> (MonoidalDMap k2 g, MonoidalDMap k2 h)
- map :: forall {k1} f g (k2 :: k1 -> Type). (forall (v :: k1). f v -> g v) -> MonoidalDMap k2 f -> MonoidalDMap k2 g
- mapWithKey :: (forall (v :: k1). k2 v -> f v -> g v) -> MonoidalDMap k2 f -> MonoidalDMap k2 g
- traverseWithKey :: forall {k1} t k2 f g. Applicative t => (forall (v :: k1). k2 v -> f v -> t (g v)) -> MonoidalDMap k2 f -> t (MonoidalDMap k2 g)
- mapAccumLWithKey :: (forall (v :: k1). a -> k2 v -> f v -> (a, g v)) -> a -> MonoidalDMap k2 f -> (a, MonoidalDMap k2 g)
- mapAccumRWithKey :: (forall (v :: k1). a -> k2 v -> f v -> (a, g v)) -> a -> MonoidalDMap k2 f -> (a, MonoidalDMap k2 g)
- mapKeysWith :: GCompare k2 => (forall (v :: k). k2 v -> f v -> f v -> f v) -> (forall (v :: k). k1 v -> k2 v) -> MonoidalDMap k1 f -> MonoidalDMap k2 f
- mapKeysMonotonic :: forall {k} k1 k2 (f :: k -> Type). (forall (v :: k). k1 v -> k2 v) -> MonoidalDMap k1 f -> MonoidalDMap k2 f
- foldrWithKey :: (forall (v :: k1). k2 v -> f v -> b -> b) -> b -> MonoidalDMap k2 f -> b
- foldlWithKey :: (forall (v :: k1). b -> k2 v -> f v -> b) -> b -> MonoidalDMap k2 f -> b
- keys :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [Some k2]
- assocs :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f]
- fromListWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> [DSum k2 f] -> MonoidalDMap k2 f
- toList :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f]
- toAscList :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f]
- toDescList :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f]
- fromAscListWithKey :: GEq k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> [DSum k2 f] -> MonoidalDMap k2 f
- split :: forall {k1} k2 (f :: k1 -> Type) (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> (MonoidalDMap k2 f, MonoidalDMap k2 f)
- splitLookup :: forall {k1} k2 f (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> (MonoidalDMap k2 f, Maybe (f v), MonoidalDMap k2 f)
- showTree :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). (GShow k2, Has' Show k2 f) => MonoidalDMap k2 f -> String
- showTreeWith :: (forall (v :: k1). k2 v -> f v -> String) -> Bool -> Bool -> MonoidalDMap k2 f -> String
- valid :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). GCompare k2 => MonoidalDMap k2 f -> Bool
Documentation
newtype MonoidalDMap (f :: k -> Type) (g :: k -> Type) Source #
Constructors
MonoidalDMap | |
Fields
|
Instances
newtype FakeDSum (f :: k -> Type) (g :: k -> Type) Source #
Constructors
FakeDSum | |
Fields
|
Instances
(GRead f, Has' Read f g) => Read (FakeDSum f g) Source # | |
(ForallF Show f, Has' Show f g) => Show (FakeDSum f g) Source # | |
(GEq f, Has' Eq f g) => Eq (FakeDSum f g) Source # | |
(GCompare f, Has' Eq f g, Has' Ord f g) => Ord (FakeDSum f g) Source # | |
Defined in Data.Dependent.Map.Monoidal |
empty :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f Source #
O(1). The empty map.
empty == fromList [] size empty == 0
singleton :: forall {k1} k2 (v :: k1) f. k2 v -> f v -> MonoidalDMap k2 f Source #
O(1). A map with a single element.
singleton 1 'a' == fromList [(1, 'a')] size (singleton 1 'a') == 1
null :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Bool Source #
O(1). Is the map empty?
size :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Int Source #
O(1). The number of elements in the map.
lookup :: forall {k1} k2 f (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Maybe (f v) Source #
deleteFindMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> (DSum k2 f, MonoidalDMap k2 f) Source #
O(log n). Delete and find the minimal element.
deleteFindMin (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((3,"b"), fromList[(5,"a"), (10,"c")]) deleteFindMin Error: can not return the minimal element of an empty map
minViewWithKey :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f, MonoidalDMap k2 f) Source #
O(log n). Retrieves the minimal (key :=> value) entry of the map, and
the map stripped of that element, or Nothing
if passed an empty map.
maxViewWithKey :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f, MonoidalDMap k2 f) Source #
O(log n). Retrieves the maximal (key :=> value) entry of the map, and
the map stripped of that element, or Nothing
if passed an empty map.
deleteFindMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> (DSum k2 f, MonoidalDMap k2 f) Source #
O(log n). Delete and find the maximal element.
deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((10,"c"), fromList [(3,"b"), (5,"a")]) deleteFindMax empty Error: can not return the maximal element of an empty map
member :: forall {k1} k2 (a :: k1) (f :: k1 -> Type). GCompare k2 => k2 a -> MonoidalDMap k2 f -> Bool Source #
O(log n). Is the key a member of the map? See also notMember
.
notMember :: forall {k1} k2 (v :: k1) (f :: k1 -> Type). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Bool Source #
O(log n). Is the key not a member of the map? See also member
.
find :: forall {k1} k2 (v :: k1) f. GCompare k2 => k2 v -> MonoidalDMap k2 f -> f v Source #
findWithDefault :: forall {k1} k2 f (v :: k1). GCompare k2 => f v -> k2 v -> MonoidalDMap k2 f -> f v Source #
O(log n). The expression (
returns
the value at key findWithDefault
def k map)k
or returns default value def
when the key is not in the map.
insert :: forall {k1} k2 f (v :: k1). GCompare k2 => k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Insert a new key and value in the map.
If the key is already present in the map, the associated value is
replaced with the supplied value. insert
is equivalent to
.insertWith
const
insertWith :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Insert with a function, combining new value and old value.
will insert the entry insertWith
f key value mpkey :=> value
into mp
if key does
not exist in the map. If the key does exist, the function will
insert the entry key :=> f new_value old_value
.
insertWith' :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
Same as insertWith
, but the combining function is applied strictly.
This is often the most desirable behavior.
insertWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Insert with a function, combining key, new value and old value.
will insert the entry insertWithKey
f key value mpkey :=> value
into mp
if key does
not exist in the map. If the key does exist, the function will
insert the entry key :=> f key new_value old_value
.
Note that the key passed to f is the same key passed to insertWithKey
.
insertWithKey' :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
Same as insertWithKey
, but the combining function is applied strictly.
insertLookupWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> (Maybe (f v), MonoidalDMap k2 f) Source #
O(log n). Combines insert operation with old value retrieval.
The expression (
)
is a pair where the first element is equal to (insertLookupWithKey
f k x map
)
and the second element equal to (lookup
k map
).insertWithKey
f k x map
insertLookupWithKey' :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> f v -> f v) -> k2 v -> f v -> MonoidalDMap k2 f -> (Maybe (f v), MonoidalDMap k2 f) Source #
O(log n). A strict version of insertLookupWithKey
.
delete :: forall {k1} k2 (f :: k1 -> Type) (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Delete a key and its value from the map. When the key is not a member of the map, the original map is returned.
adjust :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> f v) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Update a value at a specific key with the result of the provided function. When the key is not a member of the map, the original map is returned.
adjustWithKey :: forall {k1} k2 (v :: k1) f. GCompare k2 => (k2 v -> f v -> f v) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Adjust a value at a specific key. When the key is not a member of the map, the original map is returned.
adjustWithKey' :: forall {k1} k2 (v :: k1) f. GCompare k2 => (k2 v -> f v -> f v) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). A strict version of adjustWithKey
.
update :: forall {k1} k2 f (v :: k1). GCompare k2 => (f v -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
updateWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). The expression (
) updates the
value updateWithKey
f k mapx
at k
(if it is in the map). If (f k x
) is Nothing
,
the element is deleted. If it is (
), the key Just
yk
is bound
to the new value y
.
updateLookupWithKey :: forall {k1} k2 f (v :: k1). GCompare k2 => (k2 v -> f v -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> (Maybe (f v), MonoidalDMap k2 f) Source #
O(log n). Lookup and update. See also updateWithKey
.
The function returns changed value, if it is updated.
Returns the original key value if the map entry is deleted.
alter :: forall {k1} k2 f (v :: k1). GCompare k2 => (Maybe (f v) -> Maybe (f v)) -> k2 v -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
findIndex :: forall {k1} k2 (v :: k1) (f :: k1 -> Type). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Int Source #
lookupIndex :: forall {k1} k2 (f :: k1 -> Type) (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> Maybe Int Source #
O(log n). Lookup the index of a key. The index is a number from
0 up to, but not including, the size
of the map.
elemAt :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). Int -> MonoidalDMap k2 f -> DSum k2 f Source #
O(log n). Retrieve an element by index. Calls error
when an
invalid index is used.
updateAt :: (forall (v :: k1). k2 v -> f v -> Maybe (f v)) -> Int -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Update the element at index. Does nothing when an invalid index is used.
deleteAt :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). Int -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
findMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> DSum k2 f Source #
O(log n). The minimal key of the map. Calls error
is the map is empty.
lookupMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f) Source #
findMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> DSum k2 f Source #
O(log n). The maximal key of the map. Calls error
is the map is empty.
lookupMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> Maybe (DSum k2 f) Source #
deleteMin :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Delete the minimal key. Returns an empty map if the map is empty.
deleteMax :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Delete the maximal key. Returns an empty map if the map is empty.
updateMinWithKey :: (forall (v :: k1). k2 v -> f v -> Maybe (f v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Update the value at the minimal key.
updateMaxWithKey :: (forall (v :: k1). k2 v -> f v -> Maybe (f v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(log n). Update the value at the maximal key.
unionsWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> [MonoidalDMap k2 f] -> MonoidalDMap k2 f Source #
The union of a list of maps, with a combining operation:
(
).unionsWithKey
f == foldl
(unionWithKey
f) empty
unionWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> MonoidalDMap k2 f -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(n+m). Union with a combining function.
difference :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type) (g :: k1 -> Type). GCompare k2 => MonoidalDMap k2 f -> MonoidalDMap k2 g -> MonoidalDMap k2 f Source #
O(m * log (n/m + 1)), m <= n. Difference of two maps. Return elements of the first map not existing in the second map.
differenceWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> g v -> Maybe (f v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> MonoidalDMap k2 f Source #
intersectionWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> g v -> h v) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> MonoidalDMap k2 h Source #
O(m * log (n/m + 1), m <= n. Intersection with a combining function.
isSubmapOf :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). (GCompare k2, Has' Eq k2 f) => MonoidalDMap k2 f -> MonoidalDMap k2 f -> Bool Source #
O(n+m).
This function is defined as (
).isSubmapOf
= isSubmapOfBy
eqTagged
)
isSubmapOfBy :: GCompare k2 => (forall (v :: k1). k2 v -> k2 v -> f v -> g v -> Bool) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> Bool Source #
O(n+m).
The expression (
) returns isSubmapOfBy
f t1 t2True
if
all keys in t1
are in tree t2
, and when f
returns True
when
applied to their respective keys and values.
isProperSubmapOf :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). (GCompare k2, Has' Eq k2 f) => MonoidalDMap k2 f -> MonoidalDMap k2 f -> Bool Source #
O(n+m). Is this a proper submap? (ie. a submap but not equal).
Defined as (
).isProperSubmapOf
= isProperSubmapOfBy
eqTagged
isProperSubmapOfBy :: GCompare k2 => (forall (v :: k1). k2 v -> k2 v -> f v -> g v -> Bool) -> MonoidalDMap k2 f -> MonoidalDMap k2 g -> Bool Source #
O(n+m). Is this a proper submap? (ie. a submap but not equal).
The expression (
) returns isProperSubmapOfBy
f m1 m2True
when
m1
and m2
are not equal,
all keys in m1
are in m2
, and when f
returns True
when
applied to their respective keys and values.
filterWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Bool) -> MonoidalDMap k2 f -> MonoidalDMap k2 f Source #
O(n). Filter all keys/values that satisfy the predicate.
partitionWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Bool) -> MonoidalDMap k2 f -> (MonoidalDMap k2 f, MonoidalDMap k2 f) Source #
O(n). Partition the map according to a predicate. The first
map contains all elements that satisfy the predicate, the second all
elements that fail the predicate. See also split
.
mapMaybeWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Maybe (g v)) -> MonoidalDMap k2 f -> MonoidalDMap k2 g Source #
O(n). Map keys/values and collect the Just
results.
mapEitherWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> Either (g v) (h v)) -> MonoidalDMap k2 f -> (MonoidalDMap k2 g, MonoidalDMap k2 h) Source #
map :: forall {k1} f g (k2 :: k1 -> Type). (forall (v :: k1). f v -> g v) -> MonoidalDMap k2 f -> MonoidalDMap k2 g Source #
O(n). Map a function over all values in the map.
mapWithKey :: (forall (v :: k1). k2 v -> f v -> g v) -> MonoidalDMap k2 f -> MonoidalDMap k2 g Source #
O(n). Map a function over all values in the map.
traverseWithKey :: forall {k1} t k2 f g. Applicative t => (forall (v :: k1). k2 v -> f v -> t (g v)) -> MonoidalDMap k2 f -> t (MonoidalDMap k2 g) Source #
mapAccumLWithKey :: (forall (v :: k1). a -> k2 v -> f v -> (a, g v)) -> a -> MonoidalDMap k2 f -> (a, MonoidalDMap k2 g) Source #
O(n). The function mapAccumLWithKey
threads an accumulating
argument throught the map in ascending order of keys.
mapAccumRWithKey :: (forall (v :: k1). a -> k2 v -> f v -> (a, g v)) -> a -> MonoidalDMap k2 f -> (a, MonoidalDMap k2 g) Source #
O(n). The function mapAccumRWithKey
threads an accumulating
argument through the map in descending order of keys.
mapKeysWith :: GCompare k2 => (forall (v :: k). k2 v -> f v -> f v -> f v) -> (forall (v :: k). k1 v -> k2 v) -> MonoidalDMap k1 f -> MonoidalDMap k2 f Source #
O(n*log n).
is the map obtained by applying mapKeysWith
c f sf
to each key of s
.
The size of the result may be smaller if f
maps two or more distinct
keys to the same new key. In this case the associated values will be
combined using c
.
mapKeysMonotonic :: forall {k} k1 k2 (f :: k -> Type). (forall (v :: k). k1 v -> k2 v) -> MonoidalDMap k1 f -> MonoidalDMap k2 f Source #
O(n).
, but works only when mapKeysMonotonic
f s == mapKeys
f sf
is strictly monotonic.
That is, for any values x
and y
, if x
< y
then f x
< f y
.
The precondition is not checked.
Semi-formally, we have:
and [x < y ==> f x < f y | x <- ls, y <- ls] ==> mapKeysMonotonic f s == mapKeys f s where ls = keys s
This means that f
maps distinct original keys to distinct resulting keys.
This function has better performance than mapKeys
.
foldrWithKey :: (forall (v :: k1). k2 v -> f v -> b -> b) -> b -> MonoidalDMap k2 f -> b Source #
O(n). Post-order fold. The function will be applied from the lowest value to the highest.
foldlWithKey :: (forall (v :: k1). b -> k2 v -> f v -> b) -> b -> MonoidalDMap k2 f -> b Source #
O(n). Pre-order fold. The function will be applied from the highest value to the lowest.
keys :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [Some k2] Source #
O(n). Return all keys of the map in ascending order.
keys (fromList [(5,"a"), (3,"b")]) == [3,5] keys empty == []
assocs :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f] Source #
O(n). Return all key/value pairs in the map in ascending key order.
fromListWithKey :: GCompare k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> [DSum k2 f] -> MonoidalDMap k2 f Source #
O(n*log n). Build a map from a list of key/value pairs with a combining function. See also fromAscListWithKey
.
toList :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f] Source #
O(n). Convert to a list of key/value pairs.
toAscList :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f] Source #
O(n). Convert to an ascending list.
toDescList :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). MonoidalDMap k2 f -> [DSum k2 f] Source #
O(n). Convert to a descending list.
fromAscListWithKey :: GEq k2 => (forall (v :: k1). k2 v -> f v -> f v -> f v) -> [DSum k2 f] -> MonoidalDMap k2 f Source #
O(n). Build a map from an ascending list in linear time with a combining function for equal keys. The precondition (input list is ascending) is not checked.
split :: forall {k1} k2 (f :: k1 -> Type) (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> (MonoidalDMap k2 f, MonoidalDMap k2 f) Source #
O(log n). The expression (
) is a pair split
k map(map1,map2)
where
the keys in map1
are smaller than k
and the keys in map2
larger than k
.
Any key equal to k
is found in neither map1
nor map2
.
splitLookup :: forall {k1} k2 f (v :: k1). GCompare k2 => k2 v -> MonoidalDMap k2 f -> (MonoidalDMap k2 f, Maybe (f v), MonoidalDMap k2 f) Source #
O(log n). The expression (
) splits a map just
like splitLookup
k mapsplit
but also returns
.lookup
k map
showTree :: forall {k1} (k2 :: k1 -> Type) (f :: k1 -> Type). (GShow k2, Has' Show k2 f) => MonoidalDMap k2 f -> String Source #
O(n). Show the tree that implements the map. The tree is shown
in a compressed, hanging format. See showTreeWith
.
showTreeWith :: (forall (v :: k1). k2 v -> f v -> String) -> Bool -> Bool -> MonoidalDMap k2 f -> String Source #
O(n). The expression (
) shows
the tree that implements the map. Elements are shown using the showTreeWith
showelem hang wide mapshowElem
function. If hang
is
True
, a hanging tree is shown otherwise a rotated tree is shown. If
wide
is True
, an extra wide version is shown.