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

Modulesemigroupoids-6.0.1Haskell2010

Data.Semigroup.Foldable.Class

Deprecated. This module re-exports a limited subset of the class methods in the Foldable1 and Bifoldable1 classes, which are now located in the Data.Foldable1 and Data.Bifoldable1 modules in base-4.18. (On older versions of base, these can be found in the foldable1-classes-compat library.) Import from these modules instead.

  • 2 classes
classclass Foldable t => Foldable1 (t :: Type -> Type) where
#

Non-empty data structures that can be folded.

Methods

  • fold1 :: Semigroup m => t m -> m

    Given a structure with elements whose type is a Semigroup, combine them via the semigroup's (<>) operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use foldMap1' instead, with id as the map.

  • foldMap1 :: Semigroup m => (a -> m) -> t a -> m

    Map each element of the structure to a semigroup, and combine the results with (<>). This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider foldMap1' instead.

    Example1 expression
    foldMap1 (:[]) (1 :| [2, 3, 4])[1,2,3,4]
  • toNonEmpty :: t a -> NonEmpty a

    NonEmpty list of elements of a structure, from left to right.

    Example1 expression
    toNonEmpty (Identity 2)2 :| []
Instances34Foldable1, …
classclass Bifoldable t => Bifoldable1 (t :: Type -> Type -> Type) where
#

Methods

Instances15Bifoldable1, …