HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Moduleutility-ht-0.0.17.2Haskell98

Data.List.Key

Variant of Data.List functions like Data.List.group, Data.List.sort where the comparison is performed on a key computed from the list elements. In principle these functions could be replaced by e.g. sortBy (compare on f), but f will be re-computed for every comparison. If the evaluation of f is expensive, our functions are better, since they buffer the results of f.

  • 6 values
valuenub :: Eq b => (a -> b) -> [a] -> [a]
#
valuesort :: Ord b => (a -> b) -> [a] -> [a]
#
valueminimum :: Ord b => (a -> b) -> [a] -> a
#

argmin

valuemaximum :: Ord b => (a -> b) -> [a] -> a
#

argmax

valuegroup :: Eq b => (a -> b) -> [a] -> [[a]]
#

Divides a list into sublists such that the members in a sublist share the same key. It uses semantics of groupBy, not that of Data.List.groupBy.

valuemerge :: Ord b => (a -> b) -> [a] -> [a] -> [a]
#