generic

package
v1.0.146 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ap

func Ap[GB ~func() P.Pair[B, W], GAB ~func() P.Pair[func(A) B, W], GA ~func() P.Pair[A, W], W, A, B any](s SG.Semigroup[W], ga GA) func(GAB) GB

func ApS added in v1.0.107

func ApS[GS1 ~func() P.Pair[S1, W], GS2 ~func() P.Pair[S2, W], GT ~func() P.Pair[A, W], W, S1, S2, A any](
	s SG.Semigroup[W],
	setter func(A) func(S1) S2,
	fa GT,
) func(GS1) GS2

ApS attaches a value to a context [S1] to produce a context [S2] by considering the context and the value concurrently

func Applicative added in v1.0.129

func Applicative[GB ~func() P.Pair[B, W], GAB ~func() P.Pair[func(A) B, W], GA ~func() P.Pair[A, W], W, A, B any](m M.Monoid[W]) applicative.Applicative[A, B, GA, GB, GAB]

Applicative implements the applicative operations for [Writer]

func Bind added in v1.0.107

func Bind[GS1 ~func() P.Pair[S1, W], GS2 ~func() P.Pair[S2, W], GT ~func() P.Pair[A, W], W, S1, S2, A any](
	s SG.Semigroup[W],
	setter func(A) func(S1) S2,
	f func(S1) GT,
) func(GS1) GS2

Bind attaches the result of a computation to a context [S1] to produce a context [S2]

func BindTo added in v1.0.107

func BindTo[GS1 ~func() P.Pair[S1, W], GT ~func() P.Pair[A, W], W, S1, A any](
	setter func(A) S1,
) func(GT) GS1

BindTo initializes a new state [S1] from a value [T]

func Censor

func Censor[GA ~func() P.Pair[A, W], FCT ~func(W) W, W, A any](f FCT) func(GA) GA

Censor modifies the final accumulator value by applying a function

func Chain

func Chain[GB ~func() P.Pair[B, W], GA ~func() P.Pair[A, W], FCT ~func(A) GB, W, A, B any](s SG.Semigroup[W], f FCT) func(GA) GB

func ChainFirst

func ChainFirst[GB ~func() P.Pair[B, W], GA ~func() P.Pair[A, W], FCT ~func(A) GB, W, A, B any](s SG.Semigroup[W], f FCT) func(GA) GA

func Do added in v1.0.107

func Do[GS ~func() P.Pair[S, W], W, S any](m M.Monoid[W], s S) GS

Bind creates an empty context of type [S] to be used with the Bind operation

func Eq

func Eq[GA ~func() P.Pair[A, W], W, A any](w EQ.Eq[W], a EQ.Eq[A]) EQ.Eq[GA]

Constructs an equal predicate for a [Writer]

func Evaluate

func Evaluate[GA ~func() P.Pair[A, W], W, A any](fa GA) A

func Execute

func Execute[GA ~func() P.Pair[A, W], W, A any](fa GA) W

func Flap added in v1.0.110

func Flap[FAB ~func(A) B, GFAB ~func() P.Pair[FAB, W], GB ~func() P.Pair[B, W], W, A, B any](a A) func(GFAB) GB

func Flatten

func Flatten[GAA ~func() P.Pair[GA, W], GA ~func() P.Pair[A, W], W, A any](s SG.Semigroup[W], mma GAA) GA

func FromStrictEquals

func FromStrictEquals[GA ~func() P.Pair[A, W], W, A comparable]() EQ.Eq[GA]

FromStrictEquals constructs an [EQ.Eq] from the canonical comparison function

func Functor added in v1.0.129

func Functor[GB ~func() P.Pair[B, W], GA ~func() P.Pair[A, W], W, A, B any]() functor.Functor[A, B, GA, GB]

Functor implements the functor operations for [Writer]

func Let added in v1.0.107

func Let[GS1 ~func() P.Pair[S1, W], GS2 ~func() P.Pair[S2, W], W, S1, S2, A any](
	key func(A) func(S1) S2,
	f func(S1) A,
) func(GS1) GS2

Let attaches the result of a computation to a context [S1] to produce a context [S2]

func LetTo added in v1.0.107

func LetTo[GS1 ~func() P.Pair[S1, W], GS2 ~func() P.Pair[S2, W], W, S1, S2, B any](
	key func(B) func(S1) S2,
	b B,
) func(GS1) GS2

LetTo attaches the a value to a context [S1] to produce a context [S2]

func Listen added in v1.0.107

func Listen[GA ~func() P.Pair[A, W], GTA ~func() P.Pair[P.Pair[A, W], W], W, A any](fa GA) GTA

Listen modifies the result to include the changes to the accumulator

func Listens

func Listens[GA ~func() P.Pair[A, W], GAB ~func() P.Pair[P.Pair[A, B], W], FCT ~func(W) B, W, A, B any](f FCT) func(GA) GAB

Listens projects a value from modifications made to the accumulator during an action

func Map

func Map[GB ~func() P.Pair[B, W], GA ~func() P.Pair[A, W], FCT ~func(A) B, W, A, B any](f FCT) func(GA) GB

func Monad added in v1.0.129

func Monad[GB ~func() P.Pair[B, W], GAB ~func() P.Pair[func(A) B, W], GA ~func() P.Pair[A, W], W, A, B any](m M.Monoid[W]) monad.Monad[A, B, GA, GB, GAB]

Monad implements the monadic operations for [Writer]

func MonadAp

func MonadAp[GB ~func() P.Pair[B, W], GAB ~func() P.Pair[func(A) B, W], GA ~func() P.Pair[A, W], W, A, B any](s SG.Semigroup[W], fab GAB, fa GA) GB

func MonadCensor

func MonadCensor[GA ~func() P.Pair[A, W], FCT ~func(W) W, W, A any](fa GA, f FCT) GA

MonadCensor modifies the final accumulator value by applying a function

func MonadChain

func MonadChain[GB ~func() P.Pair[B, W], GA ~func() P.Pair[A, W], FCT ~func(A) GB, W, A, B any](s SG.Semigroup[W], fa GA, f FCT) GB

func MonadChainFirst

func MonadChainFirst[GB ~func() P.Pair[B, W], GA ~func() P.Pair[A, W], FCT ~func(A) GB, W, A, B any](s SG.Semigroup[W], ma GA, f FCT) GA

func MonadFlap added in v1.0.110

func MonadFlap[FAB ~func(A) B, GFAB ~func() P.Pair[FAB, W], GB ~func() P.Pair[B, W], W, A, B any](fab GFAB, a A) GB

func MonadListens

func MonadListens[GA ~func() P.Pair[A, W], GAB ~func() P.Pair[P.Pair[A, B], W], FCT ~func(W) B, W, A, B any](fa GA, f FCT) GAB

MonadListens projects a value from modifications made to the accumulator during an action

func MonadMap

func MonadMap[GB ~func() P.Pair[B, W], GA ~func() P.Pair[A, W], FCT ~func(A) B, W, A, B any](fa GA, f FCT) GB

func Of

func Of[GA ~func() P.Pair[A, W], W, A any](m M.Monoid[W], a A) GA

func Pass added in v1.0.107

func Pass[GFA ~func() P.Pair[P.Pair[A, FCT], W], GA ~func() P.Pair[A, W], FCT ~func(W) W, W, A any](fa GFA) GA

Pass applies the returned function to the accumulator

func Pointed added in v1.0.129

func Pointed[GA ~func() P.Pair[A, W], W, A any](m M.Monoid[W]) pointed.Pointed[A, GA]

Pointed implements the pointed operations for [Writer]

func Tell added in v1.0.110

func Tell[GA ~func() P.Pair[any, W], W any](w W) GA

Types

This section is empty.

Jump to

Keyboard shortcuts

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