fp

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply1

func Apply1[A, R any](f func(A) R, a A) R

Apply1 is a function that apply one argument to a function.

func Apply2

func Apply2[A, B, R any](f func(A, B) R, a A, b B) R

Apply2 is a function that takes two arguments.

func Apply3

func Apply3[A, B, C, R any](f func(A, B, C) R, a A, b B, c C) R

Apply3 is a function that takes three arguments.

func Apply4

func Apply4[A, B, C, D, R any](f func(A, B, C, D) R, a A, b B, c C, d D) R

Apply4 is a function that takes four arguments.

func Apply5

func Apply5[A, B, C, D, E, R any](f func(A, B, C, D, E) R, a A, b B, c C, d D, e E) R

Apply5 is a function that takes five arguments.

func Compose1

func Compose1[A, R any](
	f func(A) R,
) func(A) R

Compose1 is a function that compose one function.

func Compose2

func Compose2[A, B, R any](
	f func(A) B,
	g func(B) R,
) func(A) R

Compose2 is a function that compose two functions.

func Compose3

func Compose3[A, B, C, R any](
	f func(A) B,
	g func(B) C,
	h func(C) R,
) func(A) R

Compose3 is a function that compose three functions.

func Compose4

func Compose4[A, B, C, D, R any](
	f func(A) B,
	g func(B) C,
	h func(C) D,
	i func(D) R,
) func(A) R

Compose4 is a function that compose four functions.

func Compose5

func Compose5[A, B, C, D, E, R any](
	f func(A) B,
	g func(B) C,
	h func(C) D,
	i func(D) E,
	j func(E) R,
) func(A) R

Compose5 is a function that compose five functions.

func Curry1

func Curry1[A, R any](f func(A) R) func(A) R

Curry1 is a function that curry one argument function.

func Curry2

func Curry2[A, B, R any](f func(A, B) R) func(A) func(B) R

Curry2 is a function that curry two arguments function.

func Curry3

func Curry3[A, B, C, R any](f func(A, B, C) R) func(A) func(B) func(C) R

Curry3 is a function that curry three arguments function.

func Curry4

func Curry4[A, B, C, D, R any](f func(A, B, C, D) R) func(A) func(B) func(C) func(D) R

Curry4 is a function that curry four argument function.

func Curry5

func Curry5[A, B, C, D, E, R any](f func(A, B, C, D, E) R) func(A) func(B) func(C) func(D) func(E) R

Curry5 is a function that curry five argument function.

func Uncurry1

func Uncurry1[A, R any](f func(A) R) func(A) R

Uncurry1 is a function that uncurry one argument function.

func Uncurry2

func Uncurry2[A, B, R any](f func(A) func(B) R) func(A, B) R

Uncurry2 is a function that uncurry two arguments function.

func Uncurry3

func Uncurry3[A, B, C, R any](f func(A) func(B) func(C) R) func(A, B, C) R

Uncurry3 is a function that uncurry three arguments function.

func Uncurry4

func Uncurry4[A, B, C, D, R any](f func(A) func(B) func(C) func(D) R) func(A, B, C, D) R

Uncurry4 is a function that uncurry four argument function.

func Uncurry5

func Uncurry5[A, B, C, D, E, R any](f func(A) func(B) func(C) func(D) func(E) R) func(A, B, C, D, E) R

Uncurry5 is a function that uncurry five argument function.

func UseFuncState

func UseFuncState[T any](initial T) (func() T, func(func(T) T))

UseFuncState is a convenience function for creating a stateful function.

func UseState

func UseState[T any](initial T) (func() T, func(T))

UseState is a convenience function for creating a stateful function.

Types

type Fn1

type Fn1[A, R any] func(A) R

Fn1 is a function that takes one argument.

func (Fn1[A, R]) Apply

func (f Fn1[A, R]) Apply(a A) R

func (Fn1[A, R]) Curry

func (f Fn1[A, R]) Curry() func(A) R

type Fn2

type Fn2[A, B, R any] func(A, B) R

Fn2 is a function that takes two arguments.

func (Fn2[A, B, R]) Apply

func (f Fn2[A, B, R]) Apply(a A, b B) R

func (Fn2[A, B, R]) Curry

func (f Fn2[A, B, R]) Curry() func(A) func(B) R

func (Fn2[A, B, R]) Partial1 added in v0.2.0

func (f Fn2[A, B, R]) Partial1(a A) Function1[B, R]

type Fn3

type Fn3[A, B, C, R any] func(A, B, C) R

Fn3 is a function that takes three arguments.

func (Fn3[A, B, C, R]) Apply

func (f Fn3[A, B, C, R]) Apply(a A, b B, c C) R

func (Fn3[A, B, C, R]) Curry

func (f Fn3[A, B, C, R]) Curry() func(A) func(B) func(C) R

func (Fn3[A, B, C, R]) Partial1 added in v0.2.0

func (f Fn3[A, B, C, R]) Partial1(a A) Function2[B, C, R]

func (Fn3[A, B, C, R]) Partial2 added in v0.2.0

func (f Fn3[A, B, C, R]) Partial2(a A, b B) Function1[C, R]

type Fn4

type Fn4[A, B, C, D, R any] func(A, B, C, D) R

Fn4 is a function that takes four arguments.

func (Fn4[A, B, C, D, R]) Apply

func (f Fn4[A, B, C, D, R]) Apply(a A, b B, c C, d D) R

func (Fn4[A, B, C, D, R]) Curry

func (f Fn4[A, B, C, D, R]) Curry() func(A) func(B) func(C) func(D) R

func (Fn4[A, B, C, D, R]) Partial1 added in v0.2.0

func (f Fn4[A, B, C, D, R]) Partial1(a A) Function3[B, C, D, R]

func (Fn4[A, B, C, D, R]) Partial2 added in v0.2.0

func (f Fn4[A, B, C, D, R]) Partial2(a A, b B) Function2[C, D, R]

func (Fn4[A, B, C, D, R]) Partial3 added in v0.2.0

func (f Fn4[A, B, C, D, R]) Partial3(a A, b B, c C) Function1[D, R]

type Fn5

type Fn5[A, B, C, D, E, R any] func(A, B, C, D, E) R

Fn5 is a function that takes five arguments.

func (Fn5[A, B, C, D, E, R]) Apply

func (f Fn5[A, B, C, D, E, R]) Apply(a A, b B, c C, d D, e E) R

func (Fn5[A, B, C, D, E, R]) Curry

func (f Fn5[A, B, C, D, E, R]) Curry() func(A) func(B) func(C) func(D) func(E) R

func (Fn5[A, B, C, D, E, R]) Partial1 added in v0.2.0

func (f Fn5[A, B, C, D, E, R]) Partial1(a A) Function4[B, C, D, E, R]

func (Fn5[A, B, C, D, E, R]) Partial2 added in v0.2.0

func (f Fn5[A, B, C, D, E, R]) Partial2(a A, b B) Function3[C, D, E, R]

func (Fn5[A, B, C, D, E, R]) Partial3 added in v0.2.0

func (f Fn5[A, B, C, D, E, R]) Partial3(a A, b B, c C) Function2[D, E, R]

func (Fn5[A, B, C, D, E, R]) Partial4 added in v0.2.0

func (f Fn5[A, B, C, D, E, R]) Partial4(a A, b B, c C, d D) Function1[E, R]

type Function1

type Function1[A, R any] interface {
	Apply(A) R
	Curry() func(A) R
}

Function1 is a function that takes one argument.

func ComposeFunction1 added in v0.2.0

func ComposeFunction1[A, R any](f Function1[A, R]) Function1[A, R]

ComposeFunction1 is a function that compose one function.

func ComposeFunction2 added in v0.2.0

func ComposeFunction2[A, B, R any](
	f Function1[A, B],
	g Function1[B, R],
) Function1[A, R]

ComposeFunction2 is a function that compose two functions.

func ComposeFunction3 added in v0.2.0

func ComposeFunction3[A, B, C, R any](
	f Function1[A, B],
	g Function1[B, C],
	h Function1[C, R],
) Function1[A, R]

ComposeFunction3 is a function that compose three functions.

func ComposeFunction4 added in v0.2.0

func ComposeFunction4[A, B, C, D, R any](
	f Function1[A, B],
	g Function1[B, C],
	h Function1[C, D],
	i Function1[D, R],
) Function1[A, R]

ComposeFunction4 is a function that compose four functions.

func ComposeFunction5 added in v0.2.0

func ComposeFunction5[A, B, C, D, E, R any](
	f Function1[A, B],
	g Function1[B, C],
	h Function1[C, D],
	i Function1[D, E],
	j Function1[E, R],
) Function1[A, R]

ComposeFunction5 is a function that compose five functions.

type Function2

type Function2[A, B, R any] interface {
	Apply(A, B) R
	Curry() func(A) func(B) R
	Partial1(A) Function1[B, R]
}

Function2 is a function that takes two arguments.

type Function3

type Function3[A, B, C, R any] interface {
	Apply(A, B, C) R
	Curry() func(A) func(B) func(C) R
	Partial1(A) Function2[B, C, R]
	Partial2(A, B) Function1[C, R]
}

Function3 is a function that takes three arguments.

type Function4

type Function4[A, B, C, D, R any] interface {
	Apply(A, B, C, D) R
	Curry() func(A) func(B) func(C) func(D) R
	Partial1(A) Function3[B, C, D, R]
	Partial2(A, B) Function2[C, D, R]
	Partial3(A, B, C) Function1[D, R]
}

Function4 is a function that takes four arguments.

type Function5

type Function5[A, B, C, D, E, R any] interface {
	Apply(A, B, C, D, E) R
	Curry() func(A) func(B) func(C) func(D) func(E) R
	Partial1(A) Function4[B, C, D, E, R]
	Partial2(A, B) Function3[C, D, E, R]
	Partial3(A, B, C) Function2[D, E, R]
	Partial4(A, B, C, D) Function1[E, R]
}

Function5 is a function that takes five arguments.

Jump to

Keyboard shortcuts

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