foldable

package
v2.13.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Foldable

type Foldable[A, B, HKTA any] interface {
	// Reduce folds the structure from left to right using a binary function and initial value.
	Reduce(func(B, A) B, B) func(HKTA) B

	// ReduceRight folds the structure from right to left using a binary function and initial value.
	ReduceRight(func(B, A) B, B) func(HKTA) B

	// FoldMap maps each element to a monoid and combines them using the monoid's operation.
	FoldMap(m M.Monoid[B]) func(func(A) B) func(HKTA) B
}

Foldable represents a data structure that can be folded/reduced to a single value.

Foldable provides operations to collapse a structure containing multiple values into a single summary value by applying a combining function.

Type Parameters:

  • A: The type of elements in the structure
  • B: The type of the accumulated result
  • HKTA: The higher-kinded type containing A

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL