-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A Haskell sorting toolkit -- -- A library of general-purpose sorting utilities. @package sort @version 1.0.0.0 module Data.Sort -- | The sort function implements a stable sorting algorithm. It is -- a special case of sortBy, which allows the programmer to supply -- their own comparison function. sort :: Ord a => [a] -> [a] -- | The sortBy function is the non-overloaded version of -- sort. sortBy :: (a -> a -> Ordering) -> [a] -> [a] -- | Sort a list by comparing the results of a key function applied to each -- element. sortOn f is equivalent to sortBy (comparing -- f), but has the performance advantage of only evaluating -- f once for each element in the input list. This is called the -- decorate-sort-undecorate paradigm, or Schwartzian transform. sortOn :: Ord b => (a -> b) -> [a] -> [a] -- | Sort the list of associations, aggregating duplicates with the monoid. monoidSortAssocs :: (Monoid a, Ord k) => [(k, a)] -> [(k, a)] -- | Sort the list of associations, aggregating duplicates with the monoid -- and ordering the keys with the argument compare function. monoidSortAssocsBy :: (Monoid a) => (k -> k -> Ordering) -> [(k, a)] -> [(k, a)] -- | Sort the list of associations, aggregating duplicates with the -- supplied function. groupSortAssocs :: Ord k => (k -> a -> [a] -> b) -> [(k, a)] -> [(k, b)] -- | Sort the list of associations, aggregating duplicates with the -- supplied function and ordering the keys with the argument compare -- function. groupSortAssocsBy :: (k -> k -> Ordering) -> (k -> a -> [a] -> b) -> [(k, a)] -> [(k, b)] -- | Sort the list, agregating duplicates with the monoid. monoidSort :: (Monoid a, Ord a) => [a] -> [a] -- | Sort the list, agregating duplicates with the monoid and ordering the -- elements by the items generated by the argument function. monoidSortOn :: (Monoid a, Ord k) => (a -> k) -> [a] -> [a] -- | Sort the list, agregating duplicates with the monoid and ordering the -- keys with the argument compare function. monoidSortBy :: Monoid a => (a -> a -> Ordering) -> [a] -> [a] -- | Sort the list, discarding duplicates. uniqueSort :: Ord a => [a] -> [a] -- | Sort the list, discarding duplicates and ordering the elements by the -- items generated by the argument function. uniqueSortOn :: Ord k => (a -> k) -> [a] -> [a] -- | Sort the list, discarding duplicates and ordering the keys with the -- argument compare function. uniqueSortBy :: (a -> a -> Ordering) -> [a] -> [a] -- | Sort a list of elements with a stable sort, grouping together the -- equal elements with the argument grouping function groupSort :: (Ord a) => (a -> [a] -> b) -> [a] -> [b] -- | Sort a list of elements with a stable sort, using the argument -- compare function determine the ordering, grouping together -- the equal elements with the grouping function groupSortOn :: Ord k => (a -> k) -> (k -> a -> [a] -> b) -> [a] -> [b] -- | Sort a list of elements with a stable sort, grouping together the -- equal elements with the argument grouping function. groupSortBy :: (a -> a -> Ordering) -> (a -> [a] -> b) -> [a] -> [b]