úÎ!ÅO¾R      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ:(c) Clark Gaebel 2012 (c) Johan Tibel 2012 BSD-stylelibraries@haskell.org provisionalportable TrustworthyF3Rpsqueues0Return a word where only the highest bit is set.RSafe456J:!psqueuesA priority search queue with Int keys and priorities of type p and values of type v.. It is strict in keys, priorities and values.SpsqueuesEWe store masks as the index of the bit that determines the branching.psqueuesO(1) True if the queue is empty.psqueuesO(n), The number of elements stored in the queue.psqueues O(min(n,W)), Check if a key is present in the the queue.psqueues O(min(n,W))+ The priority and value of a given key, or T if the key is not bound.psqueuesO(1)& The element with the lowest priority.psqueuesO(1) The empty queue.psqueuesO(1) Build a queue with one element.psqueues O(min(n,W))¸ Insert a new key, priority and value into the queue. If the key is already present in the queue, the associated priority and value are replaced with the supplied priority and value. psqueuesOInternal function to insert a key that is *not* present in the priority queue.UpsqueuesLink psqueues O(min(n,W))„ Delete a key and its priority and value from the queue. When the key is not a member of the queue, the original queue is returned. psqueues O(min(n,W))¨ Delete the binding with the least priority, and return the rest of the queue stripped of that binding. In case the queue is empty, the empty queue is returned again. psqueues O(min(n,W)) The expression alter f k queue alters the value x at k, or absence thereof.  s can be used to insert, delete, or update a value in a queue. It also allows you to calculate an additional value b. psqueues O(min(n,W)) A variant of  ? which works on the element with the minimum priority. Unlike  A, this variant also allows you to change the key of the element.VpsqueuesSmart constructor for a W, node whose left subtree could have become X.YpsqueuesSmart constructor for a W- node whose right subtree could have become X.psqueues O(n*min(n,W))» Build a queue from a list of (key, priority, value) tuples. If the list contains more than one priority and value for the same key, the last priority and value for the key is retained.psqueuesO(n)e Convert a queue to a list of (key, priority, value) tuples. The order of the list is not specified.psqueuesO(n). Obtain the list of present keys in the queue.psqueues O(min(n,W))½ Insert a new key, priority and value into the queue. If the key is already present in the queue, then the evicted priority and value can be found the first element of the returned tuple.psqueues O(min(n,W))£ Delete a key and its priority and value from the queue. If the key was present, the associated priority and value are returned in addition to the updated queue.psqueues O(min(n,W))c Retrieve the binding with the least priority, and the rest of the queue stripped of that binding.psqueuesFReturn a list of elements ordered by key whose priorities are at most pt‚, and the rest of the queue stripped of these elements. The returned list of elements can be in any order: no guarantees there.psqueuesO(n)! Modify every value in the queue.psqueuesO(n)L Maps a function over the values and priorities of the queue. The function f< must be monotonic with respect to the priorities. I.e. if x < y, then fst (f k x v) < fst (f k y v).  The precondition is not checked. If f4 is not monotonic, then the result will be invalid.psqueuesO(n)y Strict fold over every key, priority and value in the queue. The order in which the fold is performed is not specified.Zpsqueues-Internal function that merges two *disjoint* #s that share the same prefix mask.psqueuesìInternal function to insert a key with priority larger than the maximal priority in the heap. This is always the case when using the PSQ as the basis to implement a LRU cache, which associates a access-tick-number with every element.psqueues4This name is not chosen well anymore. This function:YEither inserts a value at a new key with a prio higher than the max of the entire PSQ.•Or, overrides the value at the key with a prio strictly higher than the original prio at that key (but not necessarily the max of the entire PSQ).psqueues(This can NOT be used to delete elements.psqueuesO(n^2)# Internal function to check if the H is valid, i.e. if all invariants hold. This should always be the case.(WX[S\] ^_`aSafeK)   Safe456X†nbpsqueues Hughes's efficient sequence typepsqueuesA mapping from keys k to priorites p and values v/. It is strict in keys, priorities and values.cpsqueuesE k p v binds the key k to the value v with priority p.psqueuesO(1) True if the queue is empty. psqueuesO(1)# The number of elements in a queue.!psqueuesO(log n), Check if a key is present in the the queue."psqueuesO(log n)+ The priority and value of a given key, or T if the key is not bound.#psqueuesO(1)& The element with the lowest priority.$psqueuesO(1) The empty queue.%psqueuesO(1) Build a queue with one element.&psqueuesO(log n)¸ Insert a new key, priority and value into the queue. If the key is already present in the queue, the associated priority and value are replaced with the supplied priority and value.'psqueuesO(log n)„ Delete a key and its priority and value from the queue. When the key is not a member of the queue, the original queue is returned.(psqueuesO(log n)¨ Delete the binding with the least priority, and return the rest of the queue stripped of that binding. In case the queue is empty, the empty queue is returned again.)psqueuesO(log n) The expression alter f k queue alters the value x at k, or absence thereof. )s can be used to insert, delete, or update a value in a queue. It also allows you to calculate an additional value b.*psqueuesO(log n) A variant of )? which works on the element with the minimum priority. Unlike )A, this variant also allows you to change the key of the element.+psqueues O(n*log n)» Build a queue from a list of (key, priority, value) tuples. If the list contains more than one priority and value for the same key, the last priority and value for the key is retained.,psqueuesO(n)e Convert a queue to a list of (key, priority, value) tuples. The order of the list is not specified.-psqueuesO(n). Obtain the list of present keys in the queue..psqueuesO(n) Convert to an ascending list./psqueuesO(log n)½ Insert a new key, priority and value into the queue. If the key is already present in the queue, then the evicted priority and value can be found the first element of the returned tuple.0psqueuesO(log n)£ Delete a key and its priority and value from the queue. If the key was present, the associated priority and value are returned in addition to the updated queue.1psqueuesO(log n)c Retrieve the binding with the least priority, and the rest of the queue stripped of that binding.2psqueuesFReturn a list of elements ordered by key whose priorities are at most pt‚, and the rest of the queue stripped of these elements. The returned list of elements can be in any order: no guarantees there.3psqueuesO(n)! Modify every value in the queue.4psqueuesO(n)L Maps a function over the values and priorities of the queue. The function f< must be monotonic with respect to the priorities. I.e. if x < y, then fst (f k x v) < fst (f k y v).  The precondition is not checked. If f4 is not monotonic, then the result will be invalid.5psqueuesO(n)y Strict fold over every key, priority and value in the queue. The order in which the fold is performed is not specified.dpsqueues·Take two pennants and returns a new pennant that is the union of the two with the precondition that the keys in the first tree are strictly smaller than the keys in the second tree.epsqueuesiWhen priorities are equal, the tree with the lowest key wins. This is important to have a deterministic f, which requires on 1. pulling out the elements in the right order.gpsqueuesBalance factor6psqueuesO(n^2)# Internal function to check if the H is valid, i.e. if all invariants hold. This should always be the case.2hijklmnopqcr !"#$%&'()*+,-./012345sdtuvwxyz{|}~6SafeX‡} !"#$%&'()*+,-./0123456 !"#$%&'()*+,.-/0123456None456MX¼Ž7psqueues*A priority search queue with keys of type k and priorities of type p and values of type v.. It is strict in keys, priorities and values.psqueuesSSmart constructor which takes care of placing the minimum element directly in the €.8psqueuesO(1) True if the queue is empty.9psqueuesO(n)* The number of elements stored in the PSQ.:psqueues O(min(n,W)), Check if a key is present in the the queue.;psqueues O(min(n,W))+ The priority and value of a given key, or T if the key is not bound.<psqueuesO(1)& The element with the lowest priority.=psqueuesO(1) The empty queue.>psqueuesO(1) Build a queue with one element.?psqueues O(min(n,W))¸ Insert a new key, priority and value into the queue. If the key is already present in the queue, the associated priority and value are replaced with the supplied priority and value.@psqueues O(min(n,W))„ Delete a key and its priority and value from the queue. When the key is not a member of the queue, the original queue is returned.Apsqueues O(min(n,W))¨ Delete the binding with the least priority, and return the rest of the queue stripped of that binding. In case the queue is empty, the empty queue is returned again.Bpsqueues O(min(n,W)) The expression alter f k queue alters the value x at k, or absence thereof. Bs can be used to insert, delete, or update a value in a queue. It also allows you to calculate an additional value b.Cpsqueues O(min(n,W)) A variant of B? which works on the element with the minimum priority. Unlike BA, this variant also allows you to change the key of the element.Dpsqueues O(n*min(n,W))» Build a queue from a list of (key, priority, value) tuples. If the list contains more than one priority and value for the same key, the last priority and value for the key is retained.EpsqueuesO(n)e Convert a queue to a list of (key, priority, value) tuples. The order of the list is not specified.FpsqueuesO(n). Obtain the list of present keys in the queue.Gpsqueues O(min(n,W))½ Insert a new key, priority and value into the queue. If the key is already present in the queue, then the evicted priority and value can be found the first element of the returned tuple.Hpsqueues O(min(n,W))£ Delete a key and its priority and value from the queue. If the key was present, the associated priority and value are returned in addition to the updated queue.Ipsqueues O(min(n,W))c Retrieve the binding with the least priority, and the rest of the queue stripped of that binding.JpsqueuesFReturn a list of elements ordered by key whose priorities are at most pt‚, and the rest of the queue stripped of these elements. The returned list of elements can be in any order: no guarantees there.KpsqueuesO(n)! Modify every value in the queue.LpsqueuesO(n)L Maps a function over the values and priorities of the queue. The function f< must be monotonic with respect to the priorities. I.e. if x < y, then fst (f k x v) < fst (f k y v).  The precondition is not checked. If f4 is not monotonic, then the result will be invalid.MpsqueuesO(n)y Strict fold over every key, priority and value in the queue. The order in which the fold is performed is not specified.QpsqueuesO(n^2)# Internal function to check if the 7H is valid, i.e. if all invariants hold. This should always be the case.7€‚89:;<=>?@ABCDEFGHIJKLMNOPQNone½A789:;<=>?@ABCDEFGHIJKLMNOPQ789:;<=>?@ABCDEFGHIJKLMNOPQƒ      !"#$%&     '%(     $ !%)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[(\]&psqueues-0.2.7.1-LKcI0Nm12CbcU9OxRbi5F Data.IntPSQ Data.OrdPSQ Data.HashPSQ Data.BitUtilData.IntPSQ.InternalData.OrdPSQ.InternalData.HashPSQ.InternalIntPSQnullsizememberlookupfindMinempty singletoninsertunsafeInsertNewdelete deleteMinalteralterMinfromListtoListkeys insertView deleteViewminView atMostViewmapunsafeMapMonotonicfold'unsafeInsertIncreasePriority unsafeInsertIncreasePriorityView unsafeInsertWithIncreasePriority$unsafeInsertWithIncreasePriorityViewunsafeLookupIncreasePriorityvalidOrdPSQ toAscListHashPSQhighestBitMaskMaskbase GHC.MaybeNothinglink binShrinkLBinNil binShrinkRmergeTipKeyNat hasBadNilshasDuplicateKeyshasMinHeapProperty validMaskSequElemplaybeatsghc-prim GHC.Classes==omegaTourViewSingleNullPlayLTreeStartLLoserRLoserVoidWinnerEtourViewleftrightmaxKey lsingleLeft rsingleLeft lsingleRight rsingleRight ldoubleLeft ldoubleRight rdoubleLeft rdoubleRightmkBucketBucketB