-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Pure, fast and memory efficient integer sets. -- -- This library provides persistent, time and space efficient integer -- sets implemented as dense big-endian patricia trees with buddy -- suffixes compaction. In randomized settings this structure expected to -- be as fast as Data.IntSet from containers, but if a sets is likely to -- have long continuous intervals it should be much faster. -- --
-- interval a b = fromList [a..b] --interval :: Key -> Key -> IntSet -- | O(min(W, n) or O(1). Add a value to the set. insert :: Key -> IntSet -> IntSet -- | O(min(n, W)). Delete a value from the set. delete :: Key -> IntSet -> IntSet -- | O(n * min(W, n)). Apply the function to each element of the -- set. -- -- Do not use this operation with the universe, naturals or -- negatives sets. map :: (Key -> Key) -> IntSet -> IntSet -- | O(n). Fold the element using the given right associative binary -- operator. foldr :: (Key -> a -> a) -> a -> IntSet -> a -- | O(n). Filter all elements that satisfy the predicate. -- -- Do not use this operation with the universe, naturals or -- negatives sets. filter :: (Key -> Bool) -> IntSet -> IntSet -- | O(min(W, n). Split the set such that the left projection of the -- resulting pair contains elements less than the key and right element -- contains greater than the key. The exact key is excluded from result: -- --
-- split 5 (fromList [0..10]) == (fromList [0..4], fromList [6..10]) ---- -- Performance note: if need only lesser or greater keys, use splitLT or -- splitGT respectively. split :: Key -> IntSet -> (IntSet, IntSet) -- | O(min(W, n). Takes subset such that each element is greater -- than the specified key. The exact key is excluded from result. splitGT :: Key -> IntSet -> IntSet -- | O(min(W, n). Takes subset such that each element is less than -- the specified key. The exact key is excluded from result. splitLT :: Key -> IntSet -> IntSet -- | O(n). Split a set using given predicate. -- --
-- forall f. fst . partition f = filter f -- forall f. snd . partition f = filter (not . f) --partition :: (Key -> Bool) -> IntSet -> (IntSet, IntSet) -- | O(min(W, n)) or O(1). Find minimal element of the set. -- If set is empty then min is undefined. findMin :: IntSet -> Key -- | O(min(W, n)) or O(1). Find maximal element of the set. -- Is set is empty then max is undefined. findMax :: IntSet -> Key -- | O(n + m) or O(1). Find set which contains elements of -- both right and left sets. union :: IntSet -> IntSet -> IntSet -- | O(max(n)^2 * spine) or O(spine). The union of list of -- sets. unions :: [IntSet] -> IntSet -- | O(n + m) or O(1). Find maximal common subset of the two -- given sets. intersection :: IntSet -> IntSet -> IntSet -- | O(max(n) * spine) or O(spine). Find out common subset of -- the list of sets. intersections :: [IntSet] -> IntSet -- | O(n + m) or O(1). Find difference of the two sets. difference :: IntSet -> IntSet -> IntSet -- | O(n + m) or O(1). Find symmetric difference of the two -- sets: resulting set containts elements that either in first or second -- set, but not in both simultaneous. symDiff :: IntSet -> IntSet -> IntSet -- | Monoid under union. Used by default for IntSet. -- -- You could use Sum from Monoid as well. data Union -- | Monoid under intersection. -- -- You could use Product from Monoid as well. data Intersection -- | Monoid under symDiff. -- -- Don't mix up symDiff with difference. data Difference -- | elems is alias to toList for compatibility. elems :: IntSet -> [Key] -- | O(n). Convert the set to a list of its elements. toList :: IntSet -> [Key] -- | O(n * min(W, n)) or O(n). Create a set from a list of -- its elements. fromList :: [Key] -> IntSet -- | O(n). Convert the set to a list of its element in ascending -- order. toAscList :: IntSet -> [Key] -- | O(n). Convert the set to a list of its element in descending -- order. toDescList :: IntSet -> [Key] -- | Build a set from an ascending list of elements. fromAscList :: [Key] -> IntSet