package semigroup

import "github.com/IBM/fp-go/semigroup"

Index

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

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

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`.

Source Files

alt.go apply.go array.go semigroup.go

Directories

PathSynopsis
semigroup/ord
Version
v1.0.151 (latest)
Published
Nov 23, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
4 months ago

Tools for package owners.