Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- data DMap k f
- data DSum tag f :: (k -> *) -> (k -> *) -> * where
- data Some tag :: (k -> *) -> * where
- class GEq k f => GCompare f where
- data GOrdering a b :: k -> k -> * where
- (!) :: GCompare k => DMap k f -> k v -> f v
- (\\) :: GCompare k => DMap k f -> DMap k f -> DMap k f
- null :: DMap k f -> Bool
- size :: DMap k f -> Int
- member :: GCompare k => k a -> DMap k f -> Bool
- notMember :: GCompare k => k v -> DMap k f -> Bool
- lookup :: forall k f v. GCompare k => k v -> DMap k f -> Maybe (f v)
- findWithDefault :: GCompare k => f v -> k v -> DMap k f -> f v
- empty :: DMap k f
- singleton :: k v -> f v -> DMap k f
- insert :: forall k f v. GCompare k => k v -> f v -> DMap k f -> DMap k f
- insertWith :: GCompare k => (f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k f
- insertWith' :: GCompare k => (f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k f
- insertWithKey :: forall k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k f
- insertWithKey' :: forall k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k f
- insertLookupWithKey :: forall k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> (Maybe (f v), DMap k f)
- insertLookupWithKey' :: forall k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> (Maybe (f v), DMap k f)
- delete :: forall k f v. GCompare k => k v -> DMap k f -> DMap k f
- adjust :: GCompare k => (f v -> f v) -> k v -> DMap k f -> DMap k f
- adjustWithKey :: GCompare k => (k v -> f v -> f v) -> k v -> DMap k f -> DMap k f
- update :: GCompare k => (f v -> Maybe (f v)) -> k v -> DMap k f -> DMap k f
- updateWithKey :: forall k f v. GCompare k => (k v -> f v -> Maybe (f v)) -> k v -> DMap k f -> DMap k f
- updateLookupWithKey :: forall k f v. GCompare k => (k v -> f v -> Maybe (f v)) -> k v -> DMap k f -> (Maybe (f v), DMap k f)
- alter :: forall k f v. GCompare k => (Maybe (f v) -> Maybe (f v)) -> k v -> DMap k f -> DMap k f
- union :: GCompare k => DMap k f -> DMap k f -> DMap k f
- unionWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> DMap k f -> DMap k f -> DMap k f
- unions :: GCompare k => [DMap k f] -> DMap k f
- unionsWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> [DMap k f] -> DMap k f
- difference :: GCompare k => DMap k f -> DMap k g -> DMap k f
- differenceWithKey :: GCompare k => (forall v. k v -> f v -> g v -> Maybe (f v)) -> DMap k f -> DMap k g -> DMap k f
- intersection :: GCompare k => DMap k f -> DMap k f -> DMap k f
- intersectionWithKey :: GCompare k => (forall v. k v -> f v -> g v -> h v) -> DMap k f -> DMap k g -> DMap k h
- mapWithKey :: (forall v. k v -> f v -> g v) -> DMap k f -> DMap k g
- mapAccumLWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g)
- mapAccumRWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g)
- mapKeysWith :: GCompare k2 => (forall v. k2 v -> f v -> f v -> f v) -> (forall v. k1 v -> k2 v) -> DMap k1 f -> DMap k2 f
- mapKeysMonotonic :: (forall v. k1 v -> k2 v) -> DMap k1 f -> DMap k2 f
- foldWithKey :: (forall v. k v -> f v -> b -> b) -> b -> DMap k f -> b
- foldrWithKey :: (forall v. k v -> f v -> b -> b) -> b -> DMap k f -> b
- foldlWithKey :: (forall v. b -> k v -> f v -> b) -> b -> DMap k f -> b
- keys :: DMap k f -> [Some k]
- assocs :: DMap k f -> [DSum k f]
- toList :: DMap k f -> [DSum k f]
- fromList :: GCompare k => [DSum k f] -> DMap k f
- fromListWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> [DSum k f] -> DMap k f
- toAscList :: DMap k f -> [DSum k f]
- toDescList :: DMap k f -> [DSum k f]
- fromAscList :: GEq k => [DSum k f] -> DMap k f
- fromAscListWithKey :: GEq k => (forall v. k v -> f v -> f v -> f v) -> [DSum k f] -> DMap k f
- fromDistinctAscList :: [DSum k f] -> DMap k f
- filter :: (a -> Bool) -> [a] -> [a]
- filterWithKey :: GCompare k => (forall v. k v -> f v -> Bool) -> DMap k f -> DMap k f
- partitionWithKey :: GCompare k => (forall v. k v -> f v -> Bool) -> DMap k f -> (DMap k f, DMap k f)
- mapMaybeWithKey :: GCompare k => (forall v. k v -> f v -> Maybe (g v)) -> DMap k f -> DMap k g
- mapEitherWithKey :: GCompare k => (forall v. k v -> f v -> Either (g v) (h v)) -> DMap k f -> (DMap k g, DMap k h)
- split :: forall k f v. GCompare k => k v -> DMap k f -> (DMap k f, DMap k f)
- splitLookup :: forall k f v. GCompare k => k v -> DMap k f -> (DMap k f, Maybe (f v), DMap k f)
- isSubmapOf :: (GCompare k, EqTag k f) => DMap k f -> DMap k f -> Bool
- isSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k g -> Bool
- isProperSubmapOf :: (GCompare k, EqTag k f) => DMap k f -> DMap k f -> Bool
- isProperSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k g -> Bool
- lookupIndex :: forall k f v. GCompare k => k v -> DMap k f -> Maybe Int
- findIndex :: GCompare k => k v -> DMap k f -> Int
- elemAt :: Int -> DMap k f -> DSum k f
- updateAt :: (forall v. k v -> f v -> Maybe (f v)) -> Int -> DMap k f -> DMap k f
- deleteAt :: Int -> DMap k f -> DMap k f
- findMin :: DMap k f -> DSum k f
- findMax :: DMap k f -> DSum k f
- deleteMin :: DMap k f -> DMap k f
- deleteMax :: DMap k f -> DMap k f
- deleteFindMin :: DMap k f -> (DSum k f, DMap k f)
- deleteFindMax :: DMap k f -> (DSum k f, DMap k f)
- updateMinWithKey :: (forall v. k v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f
- updateMaxWithKey :: (forall v. k v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f
- minViewWithKey :: DMap k f -> Maybe (DSum k f, DMap k f)
- maxViewWithKey :: DMap k f -> Maybe (DSum k f, DMap k f)
- showTree :: ShowTag k f => DMap k f -> String
- showTreeWith :: (forall v. k v -> f v -> String) -> Bool -> Bool -> DMap k f -> String
- valid :: GCompare k => DMap k f -> Bool
Documentation
Dependent maps: k
is a GADT-like thing with a facility for
rediscovering its type parameter, elements of which function as identifiers
tagged with the type of the thing they identify. Real GADTs are one
useful instantiation of k
, as are Tag
s from Data.Unique.Tag in the
'prim-uniq' package.
Semantically,
is equivalent to a set of DMap
k f
where no two
elements have the same tag.DSum
k f
More informally, DMap
is to dependent products as Map
is to (->)
.
Thus it could also be thought of as a partial (in the sense of "partial
function") dependent product.
data DSum tag f :: (k -> *) -> (k -> *) -> * where
A basic dependent sum type; the first component is a tag that specifies the type of the second; for example, think of a GADT such as:
data Tag a where AString :: Tag String AnInt :: Tag Int
Then, we have the following valid expressions of type DSum Tag
:
AString :=> "hello!" AnInt :=> 42
And we can write functions that consume DSum Tag
values by matching,
such as:
toString :: DSum Tag -> String toString (AString :=> str) = str toString (AnInt :=> int) = show int
By analogy to the (key => value) construction for dictionary entries in
many dynamic languages, we use (key :=> value) as the constructor for
dependent sums. The :=> operator has very low precedence and binds to
the right, so if the Tag
GADT is extended with an additional constructor
Rec :: Tag (DSum Tag)
, then Rec :=> AnInt :=> 3 + 4
is parsed as
would be expected (Rec :=> (AnInt :=> (3 + 4))
) and has type DSum Tag
.
Its precedence is just above that of $
, so foo bar $ AString :=> "eep"
is equivalent to foo bar (AString :=> "eep")
.
data Some tag :: (k -> *) -> * where
class GEq k f => GCompare f where
Type class for comparable GADT-like structures. When 2 things are equal,
must return a witness that their parameter types are equal as well (GEQ
).
data GOrdering a b :: k -> k -> * where
A type for the result of comparing GADT constructors; the type parameters of the GADT values being compared are included so that in the case where they are equal their parameter types can be unified.
Operators
(!) :: GCompare k => DMap k f -> k v -> f v infixl 9 Source
O(log n). Find the value at a key.
Calls error
when the element can not be found.
fromList [(5,'a'), (3,'b')] ! 1 Error: element not in the map fromList [(5,'a'), (3,'b')] ! 5 == 'a'
Query
member :: GCompare k => k a -> DMap k f -> Bool Source
O(log n). Is the key a member of the map? See also notMember
.
notMember :: GCompare k => k v -> DMap k f -> Bool Source
O(log n). Is the key not a member of the map? See also member
.
findWithDefault :: GCompare k => f v -> k v -> DMap k 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.
Construction
singleton :: k v -> f v -> DMap k f Source
O(1). A map with a single element.
singleton 1 'a' == fromList [(1, 'a')] size (singleton 1 'a') == 1
Insertion
insert :: forall k f v. GCompare k => k v -> f v -> DMap k f -> DMap k 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 :: GCompare k => (f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k 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' :: GCompare k => (f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k f Source
Same as insertWith
, but the combining function is applied strictly.
This is often the most desirable behavior.
insertWithKey :: forall k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k 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 k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> DMap k f Source
Same as insertWithKey
, but the combining function is applied strictly.
insertLookupWithKey :: forall k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> (Maybe (f v), DMap k 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 k f v. GCompare k => (k v -> f v -> f v -> f v) -> k v -> f v -> DMap k f -> (Maybe (f v), DMap k f) Source
O(log n). A strict version of insertLookupWithKey
.
Delete/Update
delete :: forall k f v. GCompare k => k v -> DMap k f -> DMap k 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 :: GCompare k => (f v -> f v) -> k v -> DMap k f -> DMap k 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 :: GCompare k => (k v -> f v -> f v) -> k v -> DMap k f -> DMap k 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.
updateWithKey :: forall k f v. GCompare k => (k v -> f v -> Maybe (f v)) -> k v -> DMap k f -> DMap k 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 k f v. GCompare k => (k v -> f v -> Maybe (f v)) -> k v -> DMap k f -> (Maybe (f v), DMap k 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 k f v. GCompare k => (Maybe (f v) -> Maybe (f v)) -> k v -> DMap k f -> DMap k f Source
Combine
Union
unionWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> DMap k f -> DMap k f -> DMap k f Source
O(n+m).
Union with a combining function. The implementation uses the efficient hedge-union algorithm.
Hedge-union is more efficient on (bigset `union
` smallset).
unionsWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> [DMap k f] -> DMap k f Source
The union of a list of maps, with a combining operation:
(
).unionsWithKey
f == foldl
(unionWithKey
f) empty
Difference
difference :: GCompare k => DMap k f -> DMap k g -> DMap k f Source
O(n+m). Difference of two maps. Return elements of the first map not existing in the second map. The implementation uses an efficient hedge algorithm comparable with hedge-union.
differenceWithKey :: GCompare k => (forall v. k v -> f v -> g v -> Maybe (f v)) -> DMap k f -> DMap k g -> DMap k f Source
O(n+m). Difference with a combining function. When two equal keys are
encountered, the combining function is applied to the key and both values.
If it returns Nothing
, the element is discarded (proper set difference). If
it returns (
), the element is updated with a new value Just
yy
.
The implementation uses an efficient hedge algorithm comparable with hedge-union.
Intersection
intersection :: GCompare k => DMap k f -> DMap k f -> DMap k f Source
O(n+m). Intersection of two maps.
Return data in the first map for the keys existing in both maps.
(
).intersection
m1 m2 == intersectionWith
const
m1 m2
intersectionWithKey :: GCompare k => (forall v. k v -> f v -> g v -> h v) -> DMap k f -> DMap k g -> DMap k h Source
O(n+m). Intersection with a combining function.
Intersection is more efficient on (bigset `intersection
` smallset).
Traversal
Map
mapWithKey :: (forall v. k v -> f v -> g v) -> DMap k f -> DMap k g Source
O(n). Map a function over all values in the map.
mapAccumLWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g) Source
O(n). The function mapAccumLWithKey
threads an accumulating
argument throught the map in ascending order of keys.
mapAccumRWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g) Source
O(n). The function mapAccumRWithKey
threads an accumulating
argument through the map in descending order of keys.
mapKeysWith :: GCompare k2 => (forall v. k2 v -> f v -> f v -> f v) -> (forall v. k1 v -> k2 v) -> DMap k1 f -> DMap 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 v. k1 v -> k2 v) -> DMap k1 f -> DMap 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
.
Fold
foldWithKey :: (forall v. k v -> f v -> b -> b) -> b -> DMap k f -> b Source
Deprecated: Use foldrWithKey instead
O(n). Fold the keys and values in the map, such that
.foldWithKey
f z == foldr
(uncurry
f) z . toAscList
This is identical to foldrWithKey
, and you should use that one instead of
this one. This name is kept for backward compatibility.
foldrWithKey :: (forall v. k v -> f v -> b -> b) -> b -> DMap k f -> b Source
O(n). Post-order fold. The function will be applied from the lowest value to the highest.
foldlWithKey :: (forall v. b -> k v -> f v -> b) -> b -> DMap k f -> b Source
O(n). Pre-order fold. The function will be applied from the highest value to the lowest.
Conversion
keys :: DMap k f -> [Some k] Source
O(n). Return all keys of the map in ascending order.
keys (fromList [(5,"a"), (3,"b")]) == [3,5] keys empty == []
assocs :: DMap k f -> [DSum k f] Source
O(n). Return all key/value pairs in the map in ascending key order.
Lists
fromList :: GCompare k => [DSum k f] -> DMap k f Source
O(n*log n). Build a map from a list of key/value pairs. See also fromAscList
.
If the list contains more than one value for the same key, the last value
for the key is retained.
fromListWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> [DSum k f] -> DMap k f Source
O(n*log n). Build a map from a list of key/value pairs with a combining function. See also fromAscListWithKey
.
Ordered lists
toDescList :: DMap k f -> [DSum k f] Source
O(n). Convert to a descending list.
fromAscList :: GEq k => [DSum k f] -> DMap k f Source
O(n). Build a map from an ascending list in linear time. The precondition (input list is ascending) is not checked.
fromAscListWithKey :: GEq k => (forall v. k v -> f v -> f v -> f v) -> [DSum k f] -> DMap k 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.
fromDistinctAscList :: [DSum k f] -> DMap k f Source
O(n). Build a map from an ascending list of distinct elements in linear time. The precondition is not checked.
Filter
filter :: (a -> Bool) -> [a] -> [a]
filter
, applied to a predicate and a list, returns the list of
those elements that satisfy the predicate; i.e.,
filter p xs = [ x | x <- xs, p x]
filterWithKey :: GCompare k => (forall v. k v -> f v -> Bool) -> DMap k f -> DMap k f Source
O(n). Filter all keys/values that satisfy the predicate.
partitionWithKey :: GCompare k => (forall v. k v -> f v -> Bool) -> DMap k f -> (DMap k f, DMap k 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 k => (forall v. k v -> f v -> Maybe (g v)) -> DMap k f -> DMap k g Source
O(n). Map keys/values and collect the Just
results.
mapEitherWithKey :: GCompare k => (forall v. k v -> f v -> Either (g v) (h v)) -> DMap k f -> (DMap k g, DMap k h) Source
split :: forall k f v. GCompare k => k v -> DMap k f -> (DMap k f, DMap k 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 k f v. GCompare k => k v -> DMap k f -> (DMap k f, Maybe (f v), DMap k f) Source
O(log n). The expression (
) splits a map just
like splitLookup
k mapsplit
but also returns
.lookup
k map
Submap
isSubmapOf :: (GCompare k, EqTag k f) => DMap k f -> DMap k f -> Bool Source
O(n+m).
This function is defined as (
).isSubmapOf
= isSubmapOfBy
eqTagged
)
isSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k 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 :: (GCompare k, EqTag k f) => DMap k f -> DMap k f -> Bool Source
O(n+m). Is this a proper submap? (ie. a submap but not equal).
Defined as (
).isProperSubmapOf
= isProperSubmapOfBy
eqTagged
isProperSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k 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.
Indexed
lookupIndex :: forall k f v. GCompare k => k v -> DMap k 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 :: Int -> DMap k f -> DSum k f Source
O(log n). Retrieve an element by index. Calls error
when an
invalid index is used.
updateAt :: (forall v. k v -> f v -> Maybe (f v)) -> Int -> DMap k f -> DMap k f Source
O(log n). Update the element at index. Calls error
when an
invalid index is used.
Min/Max
findMin :: DMap k f -> DSum k f Source
O(log n). The minimal key of the map. Calls error
is the map is empty.
findMax :: DMap k f -> DSum k f Source
O(log n). The maximal key of the map. Calls error
is the map is empty.
deleteMin :: DMap k f -> DMap k f Source
O(log n). Delete the minimal key. Returns an empty map if the map is empty.
deleteMax :: DMap k f -> DMap k f Source
O(log n). Delete the maximal key. Returns an empty map if the map is empty.
deleteFindMin :: DMap k f -> (DSum k f, DMap k 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
deleteFindMax :: DMap k f -> (DSum k f, DMap k 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
updateMinWithKey :: (forall v. k v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f Source
O(log n). Update the value at the minimal key.
updateMaxWithKey :: (forall v. k v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f Source
O(log n). Update the value at the maximal key.
minViewWithKey :: DMap k f -> Maybe (DSum k f, DMap k 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 :: DMap k f -> Maybe (DSum k f, DMap k 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.
Debugging
showTree :: ShowTag k f => DMap k 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. k v -> f v -> String) -> Bool -> Bool -> DMap k 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.