úÎ_¥Z‰'      !"#$%&portable experimentalekmett@gmail.com Safe-Inferred%explicit priority/payload tuples A min-heap of values of type a. O(1). Is the heap empty?  null emptyTruenull (singleton "hello")FalseO(1)&. The number of elements in the heap.  size empty0size (singleton "hello")1size (fromList [4,1,2])3O(1). The empty heap   "a  [] size empty0O(1). A heap with a single element     x "a  [x]   x "a   x  size (singleton "hello")1 O(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)0. 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)A. 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)& 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)F. Delete the minimum key from the heap and return the resulting heap. deleteMin (fromList [3,1,2])fromList [2,3]'O(log n)D. 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   O(n log n). Perform a heap sort O(n)S. Returns the elements in the heap in some arbitrary, very likely unsorted, order. !toUnsortedList (fromList [3,1,2])[1,3,2]  (  "a *O(n)b. Map a function over the heap, returning a new heap ordered appropriately for its fresh contents map negate (fromList [3,1,2])fromList [-3,-1,-2]O(n)4. Map a monotone increasing function over the heap. 8 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)E. 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)n. 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 xsE returns a tuple where the first element is a heap consisting of the & longest prefix the least elements of xs that do not satisfyH 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  (+ . p).  O(n log n).  applied to a predicate p and a heap xsE returns a tuple where the first element is a heap consisting of the 6 longest prefix the least elements of xs that satisfy pF 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 xs" 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)N. 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)F. 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)a. Intersect the values in two heaps, returning the value in the left heap that compares as equal $O(n log n + m log m)a. 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 , side-effects. & O(n log n)Q. Traverse the elements of the heap in sorted order and produce a new heap using -ic side-effects. ^./0123456789:; < ='>?@ABCDEFG !"#$%&HIJKLMNOPQRSTUVWXYZ[\]^_`abc'  !"#$%&'  %& !"#$ S.0/123456879:; < ='>?@ABCDEFG !"#$%&HIJKLMNOPQRSTUVWXYZ[\]^_`abcd      !"#$%&'()*+),-)*./01)23)*456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij heaps-0.2.3 Data.HeapEntryprioritypayloadHeapnullsizeempty singletoninsertunion replicateunconsviewMinminimum deleteMinfromListsorttoUnsortedListmap mapMonotonicfilter partitionsplittakedropsplitAtbreakspan takeWhile dropWhilenub concatMapgroupgroupBy intersect intersectWithtraversemapM adjustMinbaseGHC.Base. Data.FoldabletoListidghc-prim GHC.ClassesnotControl.Applicative ApplicativeMonadForestNilConsTreeNoderankroot_forest ForestZipperEmpty heapDataTypefromListConstr singletonWith insertWithtreeszipperemptyZrightZadjustZreziprootZminZminZ'heapify fromListWithbothlinkskewLinkinsuniqify unionUniq skewInsertskewMeldgetMin splitForestwithList splitWithList $fOrdEntry $fEqEntry$fTraversableEntry$fFoldableEntry$fFunctorEntry$fFoldableForest$fFoldableTree$fFunctorForest $fFunctorTree$fFoldableHeap $fMonoidHeap $fOrdHeap$fEqHeap $fDataHeap $fReadHeap $fShowHeap