úÎb–]>      !"#$%&'()*+,-./0123456789:;<=(c) Edward Kmett 2010-2015 BSD-styleekmett@gmail.com experimentalportableSafe0E$LExplicit 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!" A min-heap of values of type a.O(1). The empty heap  "a  [] size empty0O(1). A heap with a single element  x "a  [x]  x "a  x  size (singleton "hello")1O(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 O(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] O(log n)@. Create a heap consisting of multiple copies of the same value.replicate 'a' 10fromList "aaaaaaaaaa" Provides 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]) Same as  O(1) . Assumes the argument is a non- heap.minimum (fromList [3,1,2])1O(log n)E. Delete the minimum key from the heap and return the resulting heap.deleteMin (fromList [3,1,2])fromList [2,3]?O(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]O(n)%. Build a heap from a list of values.  @ A "a B A @  "a   O(n log n). Perform a heap sortO(n)R. Returns the elements in the heap in some arbitrary, very likely unsorted, order.!toUnsortedList (fromList [3,1,2])[1,3,2]  @  "a BO(1)%. The number of elements in the heap. size empty0size (singleton "hello")1size (fromList [4,1,2])3O(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]O(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.map (+1) (fromList [1,2,3])fromList [2,3,4]map (*2) (fromList [1,2,3])fromList [2,4,6]O(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 []O(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")O(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") 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] O(n log n)G. Return a heap consisting of all members of given heap except for the n least elements. 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. 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  (C . p). 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, 'dropWhile p xs) 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] 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] O(n log n)). Remove duplicate entries from the heap.nub (fromList [1,1,2,6,6])fromList [1,2,6] O(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]! 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"]" O(n log n)'. Group using a user supplied function.#O(n log n + m log m)`. Intersect the values in two heaps, returning the value in the left heap that compares as equal$O(n log n + m log m)`. Intersect the values in two heaps using a function to generate the elements in the right heap.% O(n log n)Q. Traverse the elements of the heap in sorted order and produce a new heap using D side-effects.& O(n log n)Q. Traverse the elements of the heap in sorted order and produce a new heap using Eic side-effects.]FGHIJKLMNOPQRST U?VWXYZ[\]^_ !"#$%&`abcdefghijk'()*+,-./0123456'  !"#$%&'  %& !"#$ RFGHIJKLMNOPQRST U?VWXYZ[\]^_ !"#$%&`abcdefghijk'()*+,-./0123456Gl      !"#$%&'()*+,-./0123456789:;<=>?@ABCDECFGHICJCKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopq"heaps-0.3.3-7OlaDU2RmgdCkYZ3VSFd9u Data.Heapbase Data.FoldablenullEntryprioritypayloadHeapempty singletoninsertunion replicateunconsviewMinminimum deleteMinfromListsorttoUnsortedListsizemap mapMonotonicfilter partitionsplittakedropsplitAtbreakspan takeWhile dropWhilenub concatMapgroupgroupBy intersect intersectWithtraversemapM $fOrdEntry $fEqEntry$fTraversableEntry$fFoldableEntry$fFunctorEntry$fFoldableForest$fFoldableTree$fFunctorForest $fFunctorTree$fFoldableHeap $fMonoidHeap $fOrdHeap$fEqHeap $fDataHeap $fReadHeap $fShowHeap $fShowForest $fReadForest $fShowTree $fReadTree $fReadEntry $fShowEntry $fDataEntryfoldMap adjustMinGHC.Base.toListidghc-prim GHC.Classesnot ApplicativeMonadForestConsNilTreeNoderankroot_forest ForestZipperEmpty heapDataTypefromListConstr singletonWith insertWithtreeszipperemptyZrightZadjustZreziprootZminZminZ'heapify fromListWithbothlinkskewLinkinsuniqify unionUniq skewInsertskewMeldgetMin splitForestwithList splitWithList