Groups elements using results of the given function as keys.
groupBy even [1..6] :: HashMap Bool (NonEmpty Int)fromList [(False,5 :| [3,1]),(True,6 :| [4,2])]
:: a typeCtrl KGHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11
Modulerelude-1.2.2.2Haskell2010
SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable
Polymorphic grouping functions.
Groups elements using results of the given function as keys.
groupBy even [1..6] :: HashMap Bool (NonEmpty Int)fromList [(False,5 :| [3,1]),(True,6 :| [4,2])]
Similar to groupBy but keeps only one element as value.
groupOneBy even [1 .. 6] :: HashMap Bool IntfromList [(False,1),(True,2)]