semigroup

package
v1.0.143 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcatAll

func ConcatAll[A any](s Semigroup[A]) func(A) func([]A) A

func GenericConcatAll

func GenericConcatAll[GA ~[]A, A any](s Semigroup[A]) func(A) func(GA) A

func GenericMonadConcatAll

func GenericMonadConcatAll[GA ~[]A, A any](s Semigroup[A]) func(GA, A) A

func MonadConcatAll

func MonadConcatAll[A any](s Semigroup[A]) func([]A, A) A

func ToMagma added in v1.0.15

func ToMagma[A any](s Semigroup[A]) M.Magma[A]

ToMagma converts a semigroup to a magma

Types

type Semigroup

type Semigroup[A any] interface {
	M.Magma[A]
}

func AltSemigroup added in v1.0.31

func AltSemigroup[HKTA any, LAZYHKTA ~func() HKTA](
	falt func(HKTA, LAZYHKTA) HKTA,

) Semigroup[HKTA]

func ApplySemigroup

func ApplySemigroup[A, HKTA, HKTFA any](
	fmap func(HKTA, func(A) func(A) A) HKTFA,
	fap func(HKTFA, HKTA) HKTA,

	s Semigroup[A],
) Semigroup[HKTA]

* HKTA = HKT<A> HKTFA = HKT<func(A)A>

func First

func First[A any]() Semigroup[A]

First always returns the first argument.

func FunctionSemigroup

func FunctionSemigroup[A, B any](s Semigroup[B]) Semigroup[func(A) B]

FunctionSemigroup forms a semigroup as long as you can provide a semigroup for the codomain.

func Last

func Last[A any]() Semigroup[A]

Last always returns the last argument.

func MakeSemigroup

func MakeSemigroup[A any](c func(A, A) A) Semigroup[A]

func Reverse

func Reverse[A any](m Semigroup[A]) Semigroup[A]

Reverse returns The dual of a `Semigroup`, obtained by swapping the arguments of `concat`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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