Y1~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(@Do you have any idea how unsafe this method is? No, because you'#re STILL SANE ENOUGH TO READ THIS.       The ReprF type class denotes that a type can be decomposed to a representation # built out of pieces for which the TrieKey- class defines a generalized trie structure. It is required that, if ( a,  a), and  x, y :: a, then x  y  if and only if  x   y!. It is typically the case that   x y ==  ( x) ( y), as well, but this is not Z strictly required. (It is, however, the case for all instances built into the package.) As an additional note, the Key modifier is used for " bootstrapping"  instances, ' allowing a type to be used in its own  definition when wrapped in a Key modifier. A default implementation of  a. A default implementation of .  Uses the  instance of aD. (This allows for efficient and automatic implementations of e.g.  Rep String.)  [Denotes that maps on this type should be implemented with traditional binary search trees.  MDenotes that maps on this type should be treated as reversed. For instance,   might be  implemented as  (  Word) Word', to handle negative numbers properly. EIndicates that the map for this type should be bootstrapped from its TKey instance. ( This modifier is necessary to define a TKey* instance for a recursively defined type.  For example:  data Tree = Node Char [Tree]   instance 'Repr' Tree where 1 type 'Rep' Tree = ('Rep' 'Char', ['Key' Tree]) H 'toRep' (Node label children) = ('toRep' label, 'map' 'Key' children)  ...                     !"#$%&'()*+,-!"#$%&()+,-!"#$%&()+,-./0123456789:;<=>?@ABCDCC  Given a type with an associated E: instance, generates a representation that will cause its TMap 0 implementation to be essentially equivalent to Data.Map. FGKGiven the name of a type constructor, automatically generates an efficient  instance. L If you have several mutually dependent (or even mutually recursive) types,  will ( construct instances for all of them. R guarantees that any instances it generates are consistent with the ordering that  would be generated by  deriving (E)' in the data declaration. That is, if   generates an instance Repr a , then it is guaranteed that if  x, y :: a, and a  has a derived E instance, then *compare x y == compare (toRep x) (toRep y). KGiven the name of a type constructor, automatically generates an efficient  instance. L If you have several mutually dependent (or even mutually recursive) types,  will A construct instances for all of them. The instance generated by  may, in some 9 cases, be more efficient than the instance generated by  -- in particular, ^ arguments common to several constructors may be factored out, reducing the complexity of the  associated TrieKey5 instance, but leaving an ordering inconsistent with E.  Therefore, D guarantees that any instances it generates are consistent with the % ordering that would be generated by  deriving ()' in the data declaration. That is, if   generates an instance Repr a , then it is guaranteed that if  x, y :: a, and  a has a derived  instance, then  (x == y) == (toRep x == toRep y). HIJKLMNOPQR  S =  (T U)VWXYZ[\]DWe embed IntN into WordN, but we have to be careful about overflow. ^_`a  (T b) = T cd (T e) = T c, by viewing each e as two cs. f (T g) = T c, by packing multiple g s into each c for space efficiency. h (T U) = T c, by packing multiple U s into each c for space efficiency. ]]i  = cF, by way of a careful translation of their domains to avoid overflow. j  e = (c, c)k  l = cm  g = cn  U = co  b = cpqpqpqrstuvwxyz{|}~ stuvxyz{|}~ stuvtuvxyz{|}~   /A  TrieKey k instance implies that k. is a standardized representation for which a , generalized trie structure can be derived.      stuvxyz{|}~/ k is a handy alias for ( k,  ( k))!. To make a type an instance of ,  create a  instance that will satisfy  ( k)., possibly using the Template Haskell methods  provided by Data.TrieMap.Representation. A set of values a, backed by a trie. A map from keys k to values a, backed by a trie.   8 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ c a is based on  Data.IntMap. (KLMN(5OPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ( k) a is based on Data.Map.   () a is implemented as  a. ! (k1, k2) a is implemented as a  k1 ( k2 a). " ( k1 k2) a is essentially a (TrieMap k1 a, TrieMap k2 a), but = specialized for the cases where one or both maps are empty. # (  k) a is a wrapper around a TrieMap (Rep k) a. $)A)%  (  k) a is a wrapper around a  k a, that reverses the order of the operations. &' (T Word) a: is a traditional radix trie specialized for word arrays.  ( k) a is a traditional radix trie. (. The empty . Insert an element into the . Delete an element from the . O(1). Create a singleton set. The union of two !s, preferring the first set when ! equal elements are encountered.  The symmetric difference of two s. Difference of two s. !Intersection of two 4s. Elements of the result come from the first set. "0Filter all elements that satisfy the predicate. #DPartition the set into two sets, one with all elements that satisfy 1 the predicate and one with all elements that don't satisfy the predicate.  See also $. $The expression ($ x set ) is a pair  (set1,set2)  where set1 comprises the elements of set less than x and set2  comprises the elements of set greater than x. % Performs a $$ but also returns whether the pivot ( element was found in the original set. && f s! is the set obtained by applying f to each element of s. It'>s worth noting that the size of the result may be smaller if,  for some (x,y), x /= y && f x == f y '' f s == & f s, but works only when f is strictly monotonic.   The precondition is not checked.  Semi-formally, we have: / and [x < y ==> f x < f y | x <- ls, y <- ls] 5 ==> mapMonotonic f s == map f s  where ls = toList s (Post-order fold. )Pre-order fold. * The minimal element of the set. + The maximal element of the set. ,Delete the minimal element. -Delete the maximal element. .%Delete and find the minimal element. 8 'deleteFindMin' set = ('findMin' set, 'deleteMin' set) /%Delete and find the maximal element. 8 'deleteFindMax' set = ('findMax' set, 'deleteMax' set) 02Retrieves the minimal key of the set, and the set  stripped of that element, or  if passed an empty set. 12Retrieves the maximal key of the set, and the set  stripped of that element, or  if passed an empty set. 2See 4. 3See 4. 42Convert the set to an ascending list of elements. 5&Create a set from a list of elements. 6(Create a set from a vector of elements. 73Build a set from an ascending list in linear time.  :The precondition (input list is ascending) is not checked. 85Build a set from an ascending vector in linear time.  <The precondition (input vector is ascending) is not checked. 9O(n)J. Build a set from an ascending list of distinct elements in linear time.  CThe precondition (input list is strictly ascending) is not checked. :O(n)L. Build a set from an ascending vector of distinct elements in linear time.  EThe precondition (input vector is strictly ascending) is not checked. ;O(n)O. Construct a vector from the elements of this set. Does not currently fuse. <O(1). Is this the empty set? =O(1)%. The number of elements in the set. >Is the element in the set? ?Is the element not in the set? @Is this a subset? (s1 @ s2) tells whether s1 is a subset of s2. A7Is this a proper subset? (ie. a subset but not equal). BSee  . C Generate a ! by mapping on the elements of a . D_Returns the element at the specified index. Throws an error if an invalid index is specified. E_Deletes the element at the specified index. Throws an error if an invalid index is specified. F0If the specified element is in the set, returns - the index of the element, otherwise returns . . !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF.B<=>?@A! "#$%&')(*+,-./01DEFC235;64798:- !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFoGA G represents a  with a "hole" at a particular key position. Ghs are used for element-wise operations on maps (insertion, deletion and update) in a two-stage process:  A G= (and the value at that position, if any) is obtained from a  by searching or indexing.  2. A new  is made from a G* by either filling the hole with a value () or erasing it ().  HO(1). The empty map. IO(1). A map with a single element. JO(1). Is the map empty? K&Lookup the value at a key in the map. 4The function will return the corresponding value as ( value), or  if the key isn't in the map. LThe expression (L def k map) returns the value at key k or returns default value def ! when the key is not in the map. MFind the value at a key. Calls  $ when the element can not be found. NThe expression (N f k map) alters the value x at k, or absence thereof.  N7 can be used to insert, delete, or update a value in a  . In short:  K k (N f k m) = f (K k m). O'Insert a new key and value in the map. C If the key is already present in the map, the associated value is # replaced with the supplied value. O is equivalent to  P  . M insert 5 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'x')] W insert 7 'x' (fromList [(5,'a'), (3,'b')]) == fromList [(3, 'b'), (5, 'a'), (7, 'x')] ? insert 5 'x' empty == singleton 5 'x' P;Insert with a function, combining new value and old value.  P f key value mp ( will insert the pair (key, value) into mp if key does @ not exist in the map. If the key does exist, the function will  insert the pair (key, f new_value old_value). [ insertWith (++) 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "xxxa")] d insertWith (++) 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")] L insertWith (++) 5 "xxx" empty == singleton 5 "xxx" Q@Insert with a function, combining key, new value and old value.  Q f key value mp ( will insert the pair (key, value) into mp if key does @ not exist in the map. If the key does exist, the function will  insert the pair (key,f key new_value old_value). 9 Note that the key passed to f is the same key passed to Q. T let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value ^ insertWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:xxx|a")] d insertWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a"), (7, "xxx")] L insertWithKey f 5 "xxx" empty == singleton 5 "xxx" R4Combines insert operation with old value retrieval.  The expression (R f k x map) 0 is a pair where the first element is equal to (K k map) " and the second element equal to (Q f k x map). T let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ old_value p insertLookupWithKey f 5 "xxx" (fromList [(5,"a"), (3,"b")]) == (Just "a", fromList [(3, "b"), (5, "5:xxx|a")]) v insertLookupWithKey f 7 "xxx" (fromList [(5,"a"), (3,"b")]) == (Nothing, fromList [(3, "b"), (5, "a"), (7, "xxx")]) ^ insertLookupWithKey f 5 "xxx" empty == (Nothing, singleton 5 "xxx") S=Delete a key and its value from the map. When the key is not 4 a member of the map, the original map is returned. ; delete 5 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" I delete 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")] 1 delete 5 empty == empty TKUpdate a value at a specific key with the result of the provided function. H When the key is not a member of the map, the original map is returned. Y adjust ("new " ++) 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")] U adjust ("new " ++) 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")] = adjust ("new " ++) 7 empty == empty U6Adjust a value at a specific key. When the key is not 4 a member of the map, the original map is returned. * let f key x = (show key) ++ ":new " ++ x X adjustWithKey f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:new a")] R adjustWithKey f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")] : adjustWithKey f 7 empty == empty VThe expression (V f k map) updates the value x  at k (if it is in the map). If (f x) is , the element is  deleted. If it is ( y ), the key k is bound to the new value y. 6 let f x = if x == "a" then Just "new a" else Nothing O update f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")] K update f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")] = update f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" WThe expression (W f k map) updates the  value x at k (if it is in the map). If (f k x) is , # the element is deleted. If it is ( y ), the key k is bound  to the new value y. G let f k x = if x == "a" then Just ((show k) ++ ":new a") else Nothing X updateWithKey f 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "5:new a")] R updateWithKey f 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")] D updateWithKey f 3 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" X?Post-order fold. The function will be applied from the lowest  value to the highest. Y?Pre-order fold. The function will be applied from the highest  value to the lowest. Z Map each key/_element pair to an action, evaluate these actions from left to right, and collect the results. [+Map a function over all values in the map. O map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")] \+Map a function over all values in the map. & let f key x = (show key) ++ ":" ++ x Q mapWithKey f (fromList [(5,"a"), (3,"b")]) == fromList [(3, "3:b"), (5, "5:a")] ]] f s! is the map obtained by applying f to each key of s. )The size of the result may be smaller if f maps two or more distinct F keys to the same new key. In this case the value at the smallest of  these keys is retained. e mapKeys (+ 1) (fromList [(5,"a"), (3,"b")]) == fromList [(4, "b"), (6, "a")] W mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "c" W mapKeys (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "c" ^^ c f s! is the map obtained by applying f to each key of s. )The size of the result may be smaller if f maps two or more distinct G keys to the same new key. In this case the associated values will be  combined using c. c mapKeysWith (++) (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "cdab" c mapKeysWith (++) (\ _ -> 3) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 3 "cdab" __ f s == ] f s, but works only when f  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 f9 maps distinct original keys to distinct resulting keys. + This function has better performance than ]. a mapKeysMonotonic (\ k -> k * 2) (fromList [(5,"a"), (3,"b")]) == fromList [(6, "b"), (10, "a")] `The expression (` t1 t2!) takes the left-biased union of t1 and t2.  It prefers t1& when duplicate keys are encountered,  i.e. (` == a  ). ' The implementation uses the efficient  hedge-union algorithm. * Hedge-union is more efficient on (bigset ``` smallset). r union (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "a"), (7, "C")] aO(n+m)I. Union with a combining function. The implementation uses the efficient  hedge-union algorithm. | unionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "aA"), (7, "C")] bcGUnion with a combining function. The implementation uses the efficient  hedge-union algorithm. dGUnion with a combining function. The implementation uses the efficient  hedge-union algorithm. * Hedge-union is more efficient on (bigset ``` smallset). a let f key left_value right_value = Just ((show key) ++ ":" ++ left_value ++ "|" ++ right_value)  unionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "5:a|A"), (7, "C")] ee is equivalent to c ( _ _ -> Nothing). fIntersection of two maps. B Return data in the first map for the keys existing in both maps.  (f m1 m2 == g   m1 m2). a intersection (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "a" g(Intersection with a combining function. k intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" h(Intersection with a combining function. + Intersection is more efficient on (bigset `f` smallset). 4 let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar n intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A" ii f m1 m2 is equivalent to     (g f m1 m2). jj f m1 m2 is equivalent to     (h f m1 m2). kDifference of two maps. B Return elements of the first map not existing in the second map. & The implementation uses an efficient hedge algorithm comparable with  hedge-union. _ difference (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 3 "b" lSame as k. m'Difference with a combining function.  When two equal keys are M encountered, the combining function is applied to the values of these keys.  If it returns 7, the element is discarded (proper set difference). If  it returns ( y+), the element is updated with a new value y. & The implementation uses an efficient hedge algorithm comparable with  hedge-union. E let f al ar = if al == "b" then Just (al ++ ":" ++ ar) else Nothing \ differenceWith f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (3, "B"), (7, "C")])  == singleton 3 "b:B" n>Difference with a combining function. When two equal keys are L encountered, the combining function is applied to the key and both values.  If it returns 7, the element is discarded (proper set difference). If  it returns ( y+), the element is updated with a new value y. & The implementation uses an efficient hedge algorithm comparable with  hedge-union. Z let f k al ar = if al == "b" then Just ((show k) ++ ":" ++ al ++ "|" ++ ar) else Nothing ` differenceWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (3, "B"), (10, "C")])  == singleton 3 "3:b|B" o7Retrieves the value associated with minimal key of the / map, and the map stripped of that element, or  if passed an  empty map. F minView (fromList [(5,"a"), (3,"b")]) == Just ("b", singleton 5 "a")  minView empty == Nothing p7Retrieves the value associated with maximal key of the / map, and the map stripped of that element, or  if passed an F maxView (fromList [(5,"a"), (3,"b")]) == Just ("a", singleton 3 "b")  maxView empty == Nothing q"The minimal key of the map. Calls   if the map is empty. 2 findMin (fromList [(5,"a"), (3,"b")]) == (3,"b") R findMin empty Error: empty map has no minimal element r"The maximal key of the map. Calls   if the map is empty. 2 findMax (fromList [(5,"a"), (3,"b")]) == (5,"a") R findMax empty Error: empty map has no maximal element sBDelete the minimal key. Returns an empty map if the map is empty. Q deleteMin (fromList [(5,"a"), (3,"b"), (7,"c")]) == fromList [(5,"a"), (7,"c")]  deleteMin empty == empty tBDelete the maximal key. Returns an empty map if the map is empty. Q deleteMax (fromList [(5,"a"), (3,"b"), (7,"c")]) == fromList [(3,"b"), (5,"a")]  deleteMax empty == empty u%Update the value at the minimal key. d updateMin (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "Xb"), (5, "a")] U updateMin (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" v%Update the value at the maximal key. d updateMax (\ a -> Just ("X" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "Xa")] U updateMax (\ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b"  w%Update the value at the minimal key. x updateMinWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"3:b"), (5,"a")] j updateMinWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" x%Update the value at the maximal key. x updateMaxWithKey (\ k a -> Just ((show k) ++ ":" ++ a)) (fromList [(5,"a"), (3,"b")]) == fromList [(3,"b"), (5,"5:a")] j updateMaxWithKey (\ _ _ -> Nothing) (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" y%Delete and find the minimal element. b deleteFindMin (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((3,"b"), fromList[(5,"a"), (10,"c")]) t deleteFindMin Error: can not return the minimal element of an empty map z%Delete and find the maximal element. a deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) == ((10,"c"), fromList[(3,"b"),(5,"a")]) t deleteFindMax Error: can not return the maximal element of an empty map {7Retrieves the minimal (key,value) pair of the map, and & the map stripped of that element, or  if passed an empty map. Q minViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((3,"b"), singleton 5 "a") ! minViewWithKey empty == Nothing |O(log n)9. Retrieves the maximal (key,value) pair of the map, and & the map stripped of that element, or  if passed an empty map. Q maxViewWithKey (fromList [(5,"a"), (3,"b")]) == Just ((5,"a"), singleton 3 "b") ! maxViewWithKey empty == Nothing }EReturn all elements of the map in the ascending order of their keys. 2 elems (fromList [(5,"a"), (3,"b")]) == ["b","a"]  elems empty == [] ~EReturn all elements of the map in the ascending order of their keys.  Does not currently fuse. /Return all keys of the map in ascending order. - keys (fromList [(5,"a"), (3,"b")]) == [3,5]  keys empty == [] /Return all keys of the map in ascending order.  Does not currently fuse. Return all key//value pairs in the map in ascending key order. < assocs (fromList [(5,"a"), (3,"b")]) == [(3,"b"), (5,"a")]  assocs empty == [] Return all key//value pairs in the map in ascending key order.  Does not currently fuse. Map values and separate the  and  results. / let f a = if a < "c" then Left a else Right a = mapEither f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) C == (fromList [(3,"b"), (5,"a")], fromList [(1,"x"), (7,"z")])  L mapEither (\ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) ? == (empty, fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) Map keys/values and separate the  and  results. < let f k a = if k < 5 then Left (k * 2) else Right (a ++ a) D mapEitherWithKey f (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) A == (fromList [(1,2), (3,6)], fromList [(5,"aa"), (7,"zz")])  T mapEitherWithKey (\_ a -> Right a) (fromList [(5,"a"), (3,"b"), (1,"x"), (7,"z")]) ? == (empty, fromList [(1,"x"), (3,"b"), (5,"a"), (7,"z")]) O(n). Map values and collect the  results. 6 let f x = if x == "a" then Just "new a" else Nothing A mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a" Map keys/values and collect the  results. D let f k _ = if k < 5 then Just ("key : " ++ (show k)) else Nothing J mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key : 3" 6Partition the map according to a predicate. The first F map contains all elements that satisfy the predicate, the second all , elements that fail the predicate. See also . W partition (> "a") (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a") [ partition (< "x") (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty) [ partition (> "x") (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")]) 6Partition the map according to a predicate. The first F map contains all elements that satisfy the predicate, the second all , elements that fail the predicate. See also . W partition (> "a") (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a") [ partition (< "x") (fromList [(5,"a"), (3,"b")]) == (fromList [(3, "b"), (5, "a")], empty) [ partition (> "x") (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3, "b"), (5, "a")]) .Filter all values that satisfy the predicate. A filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" 7 filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty 7 filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty Filter all keys/#values that satisfy the predicate. P filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" The expression ( k map ) is a pair  (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. O split 2 (fromList [(5,"a"), (3,"b")]) == (empty, fromList [(3,"b"), (5,"a")]) C split 3 (fromList [(5,"a"), (3,"b")]) == (empty, singleton 5 "a") M split 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", singleton 5 "a") C split 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", empty) O split 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], empty) The expression ( k map) splits a map just  like  but also returns K k map. ^ splitLookup 2 (fromList [(5,"a"), (3,"b")]) == (empty, Nothing, fromList [(3,"b"), (5,"a")]) S splitLookup 3 (fromList [(5,"a"), (3,"b")]) == (empty, Just "b", singleton 5 "a") \ splitLookup 4 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Nothing, singleton 5 "a") S splitLookup 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Just "a", empty) ^ splitLookup 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], Nothing, empty) This function is defined as ( =  (==)). The expression ( f t1 t2 ) returns  if  all keys in t1 are in tree t2 , and when f returns  when A applied to their respective values. For example, the following  expressions are all :  E isSubmapOfBy (==) (fromList [('a',1)]) (fromList [('a',1),('b',2)]) E isSubmapOfBy (<=) (fromList [('a',1)]) (fromList [('a',1),('b',2)]) M isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1),('b',2)]) But the following are all : E isSubmapOfBy (==) (fromList [('a',2)]) (fromList [('a',1),('b',2)]) E isSubmapOfBy (<) (fromList [('a',1)]) (fromList [('a',1),('b',2)]) E isSubmapOfBy (==) (fromList [('a',1),('b',2)]) (fromList [('a',1)]) Build a map from a list of key/value pairs. See also . K If the list contains more than one value for the same key, the last value  for the key is retained.  fromList [] == empty F fromList [(5,"a"), (3,"b"), (5, "c")] == fromList [(5,"c"), (3,"b")] F fromList [(5,"c"), (3,"b"), (5, "a")] == fromList [(5,"a"), (3,"b")] Equivalent to  ( xs). 3Build a map from an ascending list in linear time.  :The precondition (input list is ascending) is not checked. J fromAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")] J fromAscList [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "b")] Equivalent to  ( xs). Build a map from a list of key/0value pairs with a combining function. See also . e fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "ab"), (5, "aba")]  fromListWith (++) [] == empty Equivalent to  f ( xs). \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. T fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "ba")] Equivalent to  f ( xs). Build a map from a list of key/0value pairs with a combining function. See also . e fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == fromList [(3, "ab"), (5, "aba")]  fromListWith (++) [] == empty Equivalent to  f ( xs). 3Build a map from an ascending list in linear time.  :The precondition (input list is ascending) is not checked. J fromAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")] J fromAscList [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), (5, "b")] Equivalent to  f ( xs). HBuild a map from an ascending list of distinct elements in linear time.   The precondition is not checked. I fromDistinctAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")] Equivalent to  ( xs). O(1)%. The number of elements in the map. 3 size empty == 0 3 size (singleton 1 'a') == 1 3 size (fromList([(1,'a'), (2,'c'), (3,'b')])) == 3 )Is the key a member of the map? See also . 0 member 5 (fromList [(5,'a'), (3,'b')]) == True 1 member 1 (fromList [(5,'a'), (3,'b')]) == False -Is the key not a member of the map? See also . 4 notMember 5 (fromList [(5,'a'), (3,'b')]) == False 3 notMember 1 (fromList [(5,'a'), (3,'b')]) == True  The set of all keys of the map. F keysSet (fromList [(5,"a"), (3,"b")]) == Data.TrieSet.fromList [3,5] % keysSet empty == Data.TrieSet.empty O(1)'. The key marking the position of the "hole" in the map.  loc# is the submap with keys less than  loc.  loc& is the submap with keys greater than  loc.  a loc is equivalent to O ( loc) a ( loc).  a loc is equivalent to O ( loc) a ( loc). 0Search the map for the given key, returning the F corresponding value (if any) and an updatable location for that key.  Properties:    case  k m of  (Nothing, loc) ->  loc == k &&  loc == m  (Just v, loc) ->  loc == k &&  v loc == m  K k m ==  ( k m)3Return the value and an updatable location for the  ith key in the map. Calls   if i is out of range.  Properties:    0 <= i && i <  m ==>  let (v, loc) =  i m in   ( loc) == i &&  v loc == m   i m == let (v, loc) =  i m in ( loc, v)O(log n)5. Return the value and an updatable location for the  least key in the map, or  if the map is empty.  Properties:     m > 0 ==>  let Just (v, loc) =  i m in   ( loc) == 0 &&  v loc == m  q m == let Just (v, loc) =  i m in ( loc, v)3Return the value and an updatable location for the  greatest key in the map, or  if the map is empty.  Properties:     m > 0 ==>  let Just (v, loc) =  i m in   ( loc) == 0 &&  v loc == m  r m == let Just (v, loc) =  i m in ( loc, v)1Return a map obtained by placing the given value 8 at the location (replacing an existing value, if any).  v loc ==  loc ` I ( loc) v `  loc/Return a map obtained by erasing the location.  loc ==  loc `  loc Return the index& of a key. The index is a number from  0 up to, but not including, the  of the map. Calls   when  the key is not a  of the map. O findIndex 2 (fromList [(5,"a"), (3,"b")]) Error: element is not in the map 0 findIndex 3 (fromList [(5,"a"), (3,"b")]) == 0 0 findIndex 5 (fromList [(5,"a"), (3,"b")]) == 1 O findIndex 6 (fromList [(5,"a"), (3,"b")]) Error: element is not in the map  Lookup the index& of a key. The index is a number from  0 up to, but not including, the  of the map. 8 lookupIndex 2 (fromList [(5,"a"), (3,"b")]) == Nothing 7 lookupIndex 3 (fromList [(5,"a"), (3,"b")]) == Just 0 7 lookupIndex 5 (fromList [(5,"a"), (3,"b")]) == Just 1 8 lookupIndex 6 (fromList [(5,"a"), (3,"b")]) == Nothing Retrieve an element by index. Calls   when an  invalid index is used. 3 elemAt 0 (fromList [(5,"a"), (3,"b")]) == (3,"b") 4 elemAt 1 (fromList [(5,"a"), (3,"b")]) == (5, "a") E elemAt 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range Update the element at index. Calls   when an  invalid index is used. b updateAt (\ _ _ -> Just "x") 0 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "x"), (5, "a")] b updateAt (\ _ _ -> Just "x") 1 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "x")] ^ updateAt (\ _ _ -> Just "x") 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range ^ updateAt (\ _ _ -> Just "x") (-1) (fromList [(5,"a"), (3,"b")]) Error: index out of range T updateAt (\_ _ -> Nothing) 0 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" T updateAt (\_ _ -> Nothing) 1 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" ^ updateAt (\_ _ -> Nothing) 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range ^ updateAt (\_ _ -> Nothing) (-1) (fromList [(5,"a"), (3,"b")]) Error: index out of range Delete the element at index.  Defined as ( i map =  (k x -> ) i map). > deleteAt 0 (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" > deleteAt 1 (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" H deleteAt 2 (fromList [(5,"a"), (3,"b")]) Error: index out of range H deleteAt (-1) (fromList [(5,"a"), (3,"b")]) Error: index out of range lGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~lGMlJKLHIOPQRSTUVWN`abcdekmnfghij[\]^_ZXY}~qrstyzuvwxop{|jGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ) * + , -./012234456789:;;<==>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl?Bamnop@qrsAtuvwxyzK{|}~CDFEgUVOPQRSTWHGIZ[\]^_bcdkij                           - !"#$%&'()*+,-.//0123456789:;<=>?@ABCD/EFGHIJKLMNOPQRSTUVWXYZ[\Z]^_`abcdeXfgXhiXjklmnXopqrstuvwCxyz{|}~y[[XNM     4 !!"#$%&'()B*p+,-./0123456C7\89:;<=>?@\$A BqC)BDEFGHIJK3LMNOSTPQRSTUV5W X YZ[!!$!$!\!]!^"_"_"`"a"b"c"d"e"$"f"g"h"i"j"k"l"m"n"o"p"q#r#s#t#u$v$w$x$y$z${$|$}$~$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%&&&&&&&&&&&&&&&&'''UWZZUX TrieMap-4.0.1Data.TrieMap.RepresentationData.TrieMap.ModifiersData.TrieMap.Class Data.TrieSet Data.TrieMapData.TrieMap.RadixTrie.Slice$Data.TrieMap.Representation.TH.UtilsData.TrieMap.TrieKey.SearchData.TrieMap.TrieKey.SubsetData.TrieMap.UtilsData.TrieMap.SizedData.TrieMap.TrieKey.Buildable!Data.TrieMap.Representation.Class(Data.TrieMap.Representation.TH.ReprMonad-Data.TrieMap.Representation.TH.Representation)Data.TrieMap.Representation.TH.FactorizedData.TrieMap.Representation.TH+Data.TrieMap.Representation.Instances.Basic0Data.TrieMap.Representation.Instances.ByteString-Data.TrieMap.Representation.Instances.Vectors*Data.TrieMap.Representation.Instances.Prim-Data.TrieMap.Representation.Instances.ForeignData.Vector.Build%Data.TrieMap.Representation.InstancesData.TrieMap.TrieKey.SetOpData.TrieMap.TrieKey.ProjectionControl.Monad.LookupControl.Monad.EndsData.TrieMap.TrieKeyData.TrieMap.WordMapData.TrieMap.OrdMapData.TrieMap.UnitMapData.TrieMap.ProdMapData.TrieMap.UnionMapData.TrieMap.KeyData.TrieMap.RadixTrie.LabelData.TrieMap.ReverseMapData.TrieMap.RadixTrie.EdgeData.TrieMap.RadixTrieData.TrieMap.Class.Instances toRepListtoRepRepListRepReprunOrdOrdOrderedgetRevRevgetKeyKey genOrdReprgenRepr genOptReprTrieKeyTrieMapTKeyTSetgetTSetTMapgetTMapemptyinsertdelete singletonunionsymmetricDifference difference intersectionfilter partitionsplit splitMembermap mapMonotonicfoldrfoldlfindMinfindMax deleteMin deleteMax deleteFindMin deleteFindMaxminViewmaxViewelemstoList toAscListfromList fromVector fromAscList fromAscVectorfromDistinctAscListfromDistinctAscVectortoVectornullsizemember notMember isSubsetOfisProperSubsetOf\\mapSetelemAtdeleteAt lookupIndex TLocationlookupfindWithDefault!alter insertWith insertWithKeyinsertLookupWithKeyadjust adjustWithKeyupdate updateWithKey foldrWithKey foldlWithKeytraverseWithKey mapWithKeymapKeys mapKeysWithmapKeysMonotonic unionWith unionWithKeyunionMaybeWithunionMaybeWithKeyintersectionWithintersectionWithKeyintersectionMaybeWithintersectionMaybeWithKeydifferenceWithdifferenceWithKey updateMin updateMaxupdateMinWithKeyupdateMaxWithKeyminViewWithKeymaxViewWithKey elemsVectorkeys keysVectorassocs assocsVector mapEithermapEitherWithKeymapMaybemapMaybeWithKeypartitionWithKey filterWithKey splitLookup isSubmapOf isSubmapOfBy fromListWithfromVectorWithfromAscListWithfromAscVectorWithfromListWithKeyfromVectorWithKeyfromAscListWithKeyfromAscVectorWithKeykeysSetkeybeforeafter beforeWith afterWithsearchindex minLocation maxLocationassignclear findIndexupdateAt splitSlice takeSlice dropSlice unDropSlice matchSlice iMatchSlice!$AlgCon decompose decompose'compose tyVarBndrVar tyVarBndrTypetyProdtySumfstExpsndExpleftNrightNleftExprightExpfstTysndTyisEnumTyalgCon substInAlgCon substInPred mergeWith SearchCont mapSearchNullableisNullSubset<=?LEq<<=? guardNull<**><*>puremanysome<|> AlternativegetConstConst unwrapMonad WrapMonad WrappedMonad unwrapArrow WrapArrow WrappedArrow getZipListZipList Data.MonoidmconcatmappendmemptyMonoid Data.Functor<$>guardmplusmzeroGHC.Base<$WHoleNodeBinTipNilSNodesznodePathRightBinLeftBinRootSizeMaskPrefixNatsNode WordStackPushNadaStackhole insertWithCsearchC branchHolelookupCsingletonMaybemask0nomatchmatchzeroNmaskshorter branchMaskhighestBitMaskjoinnilbinbin'unifier $fTrieKeyWordWordMap getWordMapgetHolecount immoralCast ImmoralCastNoYesnCounttiprebuildfromDistAscList hedgeUnionfilterGtfilterLttrim trimLookupLo hedgeDiff joinMaybe insertMax insertMinmergegluebalancerotateLrotateRsingleLsingleRdoubleLdoubleR$fTrieKeyOrderedsingle $fTrieKey() Data.MaybeMaybegNullprodFold $fTrieKey(,)UViewHole1Hole2HViewJustLJustRBoth^mapLR singletonL singletonRuViewhViewhole1hole2runUViewholes unionFold$fTrieKeyEitherRepMapkeyMapkeyRep $fTrieKeyKeysViewlocViewpVieweViewstacklocdeeprootedge'edgeEdgeLocEdgeLabelBHoleBranchEViewLocLocViewDeepPView StackViewMEdgeHangViewHHTTHang singletonEdge singleLoc getSimpleEdgedropEdge unDropEdgecEdgebranchbViewULocRT runULocRTSEdgeXSEdgeSDeepXSDeepSRootSLocPTipPStackZPStackAPStackAZVLocRT runVLocRTVEdgeXVEdgeVDeepXVDeepVRootVLocVTipVStackZVStackAVStackAZ runDualPlusDualPlusrunDualDual runRevFoldRevFold reverseFold $fTrieKeyRev lookupEdge searchEdgeC mapMaybeEdge mapEitherEdge assignEdge clearEdge unionEdge isectEdgediffEdge beforeEdge afterEdgeextractEdgeLoc indexEdge insertEdgefromAscListEdgeWordVec$fTrieKeyVector$fTrieKeyVector0 Data.VectorNothingfromFoldStreamJustTLocGHC.Errerrorconstid updateHelperLeftRightGHC.BoolTrueFalseData.Vector.Generic Data.TuplefstextractfillHole