úÎ!a%]@      !"#$%&'()*+,-./0123456789:;<=>?(c) Edward Kmett 2010-2015 BSD-styleekmett@gmail.com experimentalportableSafe2I[Ð$heapsLExplicit priority/payload tuples. Useful to build a priority queue using a 7, since the payload is ignored in the Eq/Ord instances.  myHeap =  [ 2 "World",  1 "Hello",  3 "!"] ==> @  myHeap "a "HelloWorld!" heapsA min-heap of values of type a.heapsO(1). The empty heap  "a  [] size empty0heapsO(1). A heap with a single element  x "a  [x]  x "a  x  size (singleton "hello")1heapsO(1)#. Insert a new value into the heap.insert 2 (fromList [1,3])fromList [1,2,3]  x  "a  x  ( x xs) "a 1 +  xs heapsO(1)/. Meld the values from two heaps into one heap.+union (fromList [1,3,5]) (fromList [6,4,2])fromList [1,2,6,4,3,5]+union (fromList [1,1,1]) (fromList [1,2,1])fromList [1,1,1,2,1,1] heapsO(log n)@. Create a heap consisting of multiple copies of the same value.replicate 'a' 10fromList "aaaaaaaaaa" heapsProvides both O(1)# access to the minimum element and O(log n)E access to the remainder of the heap. This is the same operation as  uncons (fromList [2,1,3])Just (1,fromList [2,3]) heapsSame as  heapsO(1) . Assumes the argument is a non- heap.minimum (fromList [3,1,2])1heapsO(log n)E. Delete the minimum key from the heap and return the resulting heap.deleteMin (fromList [3,1,2])fromList [2,3]AheapsO(log n)C. Adjust the minimum key in the heap and return the resulting heap.!adjustMin (+1) (fromList [1,2,3])fromList [2,2,3]heapsO(n)%. Build a heap from a list of values.  B C "a D C B  "a  heaps O(n log n). Perform a heap sortheapsO(n)R. Returns the elements in the heap in some arbitrary, very likely unsorted, order.!toUnsortedList (fromList [3,1,2])[1,3,2]  B  "a DheapsO(1)%. The number of elements in the heap. size empty0size (singleton "hello")1size (fromList [4,1,2])3heapsO(n)a. Map a function over the heap, returning a new heap ordered appropriately for its fresh contentsmap negate (fromList [3,1,2])fromList [-3,-1,-2]heapsO(n)l. Map a monotone increasing function over the heap. Provides a better constant factor for performance than ˜, but no checking is performed that the function provided is monotone increasing. Misuse of this function can cause a Heap to violate the heap property.$mapMonotonic (+1) (fromList [1,2,3])fromList [2,3,4]$mapMonotonic (*2) (fromList [1,2,3])fromList [2,4,6]heapsO(n)D. Filter the heap, retaining only values that satisfy the predicate.filter (>'a') (fromList "ab") fromList "b"filter (>'x') (fromList "ab") fromList []filter (<'a') (fromList "ab") fromList []heapsO(n)ª. Partition the heap according to a predicate. The first heap contains all elements that satisfy the predicate, the second all elements that fail the predicate. See also . partition (>'a') (fromList "ab")(fromList "b",fromList "a")heapsO(n)m. Partition the heap into heaps of the elements that are less than, equal to, and greater than a given value.split 'h' (fromList "hello")*(fromList "e",fromList "h",fromList "llo")heaps O(n log n)(. Return a heap consisting of the least n elements of a given heap."take 3 (fromList [10,2,4,1,9,8,2])fromList [1,2,2]heaps O(n log n)G. Return a heap consisting of all members of given heap except for the n least elements.heaps O(n log n)8. Split a heap into two heaps, the first containing the n\ least elements, the latter consisting of all members of the heap except for those elements.heaps O(n log n).  applied to a predicate p and a heap xsk returns a tuple where the first element is a heap consisting of the longest prefix the least elements of xs that do not satisfyG p and the second element is the remainder of the elements in the heap.8break (\x -> x `mod` 4 == 0) (fromList [3,5,7,12,13,16])&(fromList [3,5,7],fromList [12,13,16]) p is equivalent to  (E . p).heaps O(n log n).  applied to a predicate p and a heap xs{ returns a tuple where the first element is a heap consisting of the longest prefix the least elements of xs that satisfy pE and the second element is the remainder of the elements in the heap.5span (\x -> x `mod` 4 == 0) (fromList [4,8,12,14,16])$(fromList [4,8,12],fromList [14,16]) p xs is equivalent to ( p xs,  p xs)heaps O(n log n).  applied to a predicate p and a heap xsH returns a heap consisting of the longest prefix the least elements of xs that satisfy p.:takeWhile (\x -> x `mod` 4 == 0) (fromList [4,8,12,14,16])fromList [4,8,12]heaps O(n log n).  p xs0 returns the suffix of the heap remaining after  p xs.:dropWhile (\x -> x `mod` 4 == 0) (fromList [4,8,12,14,16])fromList [14,16]heaps O(n log n)). Remove duplicate entries from the heap.nub (fromList [1,1,2,6,6])fromList [1,2,6] heapsO(n)M. Construct heaps from each element in another heap, and union them together.3concatMap (\a -> fromList [a,a+1]) (fromList [1,4])fromList [1,4,5,2]!heaps O(n log n)E. Group a heap into a heap of heaps, by unioning together duplicates.group (fromList "hello")?fromList [fromList "e",fromList "h",fromList "ll",fromList "o"]"heaps O(n log n)'. Group using a user supplied function.#heapsO(n log n + m log m)`. Intersect the values in two heaps, returning the value in the left heap that compares as equal$heapsO(n log n + m log m)`. Intersect the values in two heaps using a function to generate the elements in the right heap.%heaps O(n log n)Q. Traverse the elements of the heap in sorted order and produce a new heap using F side-effects.&heaps O(n log n)Q. Traverse the elements of the heap in sorted order and produce a new heap using Gic side-effects.'  !"#$%&'  %& !"#$ H5I      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGEHIJKELEMNO$heaps-0.3.6.1-FbztQFLzLVD5oeX5TA4nUO Data.Heapbase Data.FoldablenullEntryprioritypayloadHeapempty singletoninsertunion replicateunconsviewMinminimum deleteMinfromListsorttoUnsortedListsizemap mapMonotonicfilter partitionsplittakedropsplitAtbreakspan takeWhile dropWhilenub concatMapgroupgroupBy intersect intersectWithtraversemapM$fFoldableForest$fFoldableTree$fFunctorForest $fFunctorTree$fFoldableHeap $fMonoidHeap$fSemigroupHeap $fOrdHeap$fEqHeap $fDataHeap $fReadHeap $fShowHeap $fOrdEntry $fEqEntry$fTraversableEntry$fFoldableEntry$fBifunctorEntry$fFunctorEntry $fShowForest $fReadForest $fShowTree $fReadTree $fReadEntry $fShowEntry $fDataEntryfoldMap adjustMinGHC.Base.toListidghc-prim GHC.Classesnot ApplicativeMonadCons