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.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulerelude-1.2.0.0Haskell2010
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)]