HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulerelude-1.2.0.0Haskell2010

Relude.Extra.Group

SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable

Polymorphic grouping functions.

  • 2 values
  • Packagerelude-1.2.0.0
  • Exports2
  • LanguageHaskell2010
  • LicenceMIT
  • SourceGroup.hs
valuegroupBy
  1. :: (Foldable f, DynamicMap t, Val t ~ NonEmpty a, Monoid t)
  2. => a -> Key t
  3. -> f a
  4. -> t
#

Groups elements using results of the given function as keys.

Example1 expression
groupBy even [1..6] :: HashMap Bool (NonEmpty Int)fromList [(False,5 :| [3,1]),(True,6 :| [4,2])]
valuegroupOneBy
  1. :: (Foldable f, DynamicMap t, Val t ~ a, Monoid t)
  2. => a -> Key t
  3. -> f a
  4. -> t
#

Similar to groupBy but keeps only one element as value.

Example1 expression
groupOneBy even [1 .. 6] :: HashMap Bool IntfromList [(False,1),(True,2)]