package endomorphism

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

Index

Functions

func Ap

func Ap[A any](fa A) func(Endomorphism[A]) A

func Curry2

func Curry2[FCT ~func(T0, T1) T1, T0, T1 any](f FCT) func(T0) Endomorphism[T1]

Curry2 curries a binary function

func Curry3

func Curry3[FCT ~func(T0, T1, T2) T2, T0, T1, T2 any](f FCT) func(T0) func(T1) Endomorphism[T2]

Curry3 curries a ternary function

func MonadAp

func MonadAp[A any](fab Endomorphism[A], fa A) A

func Monoid

func Monoid[A any]() M.Monoid[Endomorphism[A]]

Monoid for the Endomorphism where the `concat` operation is the usual function composition.

func Semigroup

func Semigroup[A any]() S.Semigroup[Endomorphism[A]]

Semigroup for the Endomorphism where the `concat` operation is the usual function composition.

func Unwrap

func Unwrap[F ~func(A) A, A any](f Endomorphism[A]) F

Unwrap converts any Endomorphism to a function

Types

type Endomorphism

type Endomorphism[A any] func(A) A

Endomorphism is a function that

func Chain

func Chain[A any](f Endomorphism[A]) Endomorphism[Endomorphism[A]]

func Identity

func Identity[A any]() Endomorphism[A]

Identity returns the identity Endomorphism

func MonadChain

func MonadChain[A any](ma Endomorphism[A], f Endomorphism[A]) Endomorphism[A]

func Of

func Of[F ~func(A) A, A any](f F) Endomorphism[A]

Of converts any function to an Endomorphism

func Wrap

func Wrap[F ~func(A) A, A any](f F) Endomorphism[A]

Wrap converts any function to an Endomorphism

Source Files

curry.go endo.go monoid.go

Directories

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

Tools for package owners.