state

package
v1.0.148 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ap

func Ap[S, A, B any](ga State[S, A]) func(State[S, func(A) B]) State[S, B]

func Applicative

func Applicative[S, A, B any]() applicative.Applicative[A, B, State[S, A], State[S, B], State[S, func(A) B]]

Applicative implements the applicative operations for State

func Chain

func Chain[S any, FCT ~func(A) State[S, B], A, B any](f FCT) func(State[S, A]) State[S, B]

func ChainFirst

func ChainFirst[S any, FCT ~func(A) State[S, B], A, B any](f FCT) func(State[S, A]) State[S, A]

func Eq

func Eq[S, A any](w EQ.Eq[S], a EQ.Eq[A]) func(S) EQ.Eq[State[S, A]]

Constructs an equal predicate for a State

func Evaluate

func Evaluate[A, S any](s S) func(State[S, A]) A

func Execute

func Execute[A, S any](s S) func(State[S, A]) S

func Flap

func Flap[S, A, B any](a A) func(State[S, func(A) B]) State[S, B]

func FromStrictEquals

func FromStrictEquals[S, A comparable]() func(S) EQ.Eq[State[S, A]]

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

func Functor

func Functor[S, A, B any]() functor.Functor[A, B, State[S, A], State[S, B]]

Functor implements the pointed operations for State

func Map

func Map[S any, FCT ~func(A) B, A, B any](f FCT) func(State[S, A]) State[S, B]

func Monad

func Monad[S, A, B any]() monad.Monad[A, B, State[S, A], State[S, B], State[S, func(A) B]]

Monad implements the monadic operations for State

func Pointed

func Pointed[S, A any]() pointed.Pointed[A, State[S, A]]

Pointed implements the pointed operations for State

Types

type State

type State[S, A any] R.Reader[S, P.Pair[A, S]]

State represents an operation on top of a current State that produces a value and a new State

func Flatten

func Flatten[S, A any](mma State[S, State[S, A]]) State[S, A]

func Get

func Get[S any]() State[S, S]

func Gets

func Gets[FCT ~func(S) A, A, S any](f FCT) State[S, A]

func Modify

func Modify[FCT ~func(S) S, S any](f FCT) State[S, any]

func MonadAp

func MonadAp[S, A, B any](fab State[S, func(A) B], fa State[S, A]) State[S, B]

func MonadChain

func MonadChain[S any, FCT ~func(A) State[S, B], A, B any](fa State[S, A], f FCT) State[S, B]

func MonadChainFirst

func MonadChainFirst[S any, FCT ~func(A) State[S, B], A, B any](ma State[S, A], f FCT) State[S, A]

func MonadFlap

func MonadFlap[FAB ~func(A) B, S, A, B any](fab State[S, FAB], a A) State[S, B]

func MonadMap

func MonadMap[S any, FCT ~func(A) B, A, B any](fa State[S, A], f FCT) State[S, B]

func Of

func Of[S, A any](a A) State[S, A]

func Put

func Put[S any]() State[S, any]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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