úÎeåa15      !"#$%&'()*+,-./01234(c) Atze van der Ploeg 2013 BSD-styleatzeus@gmail.org provisionalportableNone!"<HM ‚A monad that can be used to create keys Keys cannot escape the monad, analogous to the ST Monad. Can be used instead of the > function if you need an statically unknown number of keys.?The applicative instance is more non-strict than the standard 5:Flet hang = getKey >> hang in snd $ runIdentity $ runKeyT $ pure (,)  * hang  */ (getKey >> return 2) does not hang, but with 5 it does.The scope of top-level keys.The datatype of Keys. x*The scope of this key. This can either be ! for top-level keys created with 6 or an existential type for keys introduced by  (or with the Key monad ).a2The type of things that can be sorted at this key. For example,  Key T Int? is a top-level key that can be used to store values of type Int in a heterogenous map.O(1)k. Scopes a key to the given function The key cannot escape the function (because of the existential type).cThe implementation actually *creates* a key, but because the key cannot escape the given function f-, there is no way to observe that if we run  withKey f9 twice, that it will get a different key the second time.O(1). Create a new top-level key.Obtain a key in the key monad /Obtain a key in the key monad, alias for newKey Split of a keyT computation.ÄAs an analogy, think of a random number generator some random number generator can be split, from one random number generator we obtain two distinct random number generator that are unrelated.ÚThe KeyT monad gives us access to a name source, this operation allows us to split the name source. The generated name from both this and the split off computation have the same scope, but are otherwise underlated.pNotice that the sharing of the same scope is not a problem because the monad ensures referential transparency. @Run a key monad. Existential type makes sure keys cannot escape.$6789:;<=>?@ABC DEFGHIJKLB 6789<;:=A@?>BC DEFGHIJKLNone!"<HMMNOMNOMNO(c) Atze van der Ploeg 2013 BSD-styleatzeus@gmail.org provisionalportableNone!"<HMMake an Untypeable value9Project (i.e. cast) an untypeable value with a given key. P   PNone!"<HM    (c) Atze van der Ploeg 2013 BSD-styleatzeus@gmail.org provisionalportableNone!"+<HMThe type of hetrogenous maps.O(log n)". Find the value at a key. Calls Q# when the element can not be found.Same as $.O(1). Is the map empty?O(1)$. The number of elements in the map.O(log n)'. Lookup the value at a key in the map.4The function will return the corresponding value as (R value), or S if the key isn't in the map.O(log n)+. Is the key a member of the map? See also .O(log n)/. Is the key not a member of the map? See also .TO(log n)". Find the value at a key. Calls Q# when the element can not be found.O(log n). The expression ( def k map) returns the value at key k or returns default value def! when the key is not in the map.O(1). The empty map.O(1). A map with a single element.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.  is equivalent to  U.O(log n)>. Insert with a function, combining new value and old value.  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).O(log n)r. Delete a key and its value from the map. When the key is not a member of the map, the original map is returned.O(log n):. Delete a value from the map using Unique instead of HKeyO(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. O(log n). The expression (  f k map) updates the value x at k (if it is in the map). If (f x) is S%, the element is deleted. If it is (R y ), the key k is bound to the new value y.!O(log n). The expression (! f k map) alters the value x at k, or absence thereof. !7 can be used to insert, delete, or update a value in a Map. In short :  k (! f k m) = f ( k m)."!The union of a list of maps: (" == V # ).#O(n+m). The expression (# t1 t2!) takes the left-biased union of t1 and t2. It prefers t1% when duplicate keys are encountered.$O(n+m)[. Difference of two maps. Return elements of the first map not existing in the second map.%O(n+m)]. Intersection of two maps. Return data in the first map for the keys existing in both maps.WT !"#$%X#  !"#$% !#"$%WT !"#$%X  (c) Atze van der Ploeg 2013 BSD-styleatzeus@gmail.org provisionalportableNone!"<HM&!The type of hetrogenous key sets.'O(1) Construct an empty key set.(O(1)' Construct a set with a single element.)O(n+m)< Construct a key set containing all elements from both sets.UTo obtain good performance, the smaller set must be presented as the first argument.*DConstruct a key set containing all elements from a list of key sets.+O(1) Return Y if this key set is empty, Z otherwise.,O(n)+ Return the number of elements in this set.- O(min(n,W)) Return Y- if the given value is present in this set, Z otherwise.. O(min(n,W))% Add the specified value to this set./ O(min(n,W))6 Remove the specified value from this set if present.0O(n)V Difference of two sets. Return elements of the first set not existing in the second.1O(n)Y Intersection of two sets. Return elements present in both the first set and the second.2O(n)%. Does the map carry any of the keys?3O(n)/. Do the keyset and the map have the same keys?4O(n)/. Remove the keys from the keyset from the map.&['()*+,-./01234&'()*+,-./01234&'()*+,-./01234&['()*+,-./01234\      !"#$%&'()*+,- !*)"$+,./01234567589:;<=>?@ABCDEFGHHI1JK1LM1LNO1PQ1RSTUVWUVX-Y HMap-1.2.7 Data.HKeyData.Untypeable Data.HMap Data.HKeySetData.HKeyPrivate Data.HideTypeKeyKeyTKeyMTHKeywithKey createKeyuniquenewKeygetKey keyTSplitrunKeyrunKeyT UntypeableinjectprojectHMap!\\nullsizelookupmember notMemberfindWithDefaultempty singletoninsert insertWithdelete deleteUniqueadjustupdatealterunionsunion difference intersectionHKeySetoverlapsameKeys removeKeysbase Control.MonadapgetKTBindTermMPrimReturnGDGDFixSplitGetKeyLift interpret$fMonadTransKeyT$fMonadFixKeyT $fMonadKeyT$fApplicativeKeyT $fFunctorKeyT$fApplicativeTermM$fFunctorTermM $fMonadTermM$fHashableUniqueHideTypeunsafeFromHideTypeGHC.Errerror Data.MaybeJustNothingfindGHC.BaseconstGHC.Listfoldl $fDefaultHMapghc-prim GHC.TypesTrueFalse