generic

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After[GA ~func() A, A any](timestamp time.Time) func(GA) GA

After creates an operation that passes after the given timestamp

func Ap

func Ap[GB ~func() B, GAB ~func() func(A) B, GA ~func() A, B, A any](ma GA) func(GAB) GB

func ApFirst deprecated

func ApFirst[GA ~func() A, GB ~func() B, GBA ~func() func(B) A, A, B any](second GB) func(GA) GA

ApFirst combines two effectful actions, keeping only the result of the first.

Deprecated:

func ApFirstPar deprecated

func ApFirstPar[GA ~func() A, GB ~func() B, GBA ~func() func(B) A, A, B any](second GB) func(GA) GA

ApFirstPar combines two effectful actions, keeping only the result of the first.

Deprecated:

func ApFirstSeq deprecated

func ApFirstSeq[GA ~func() A, GB ~func() B, GBA ~func() func(B) A, A, B any](second GB) func(GA) GA

ApFirstSeq combines two effectful actions, keeping only the result of the first.

Deprecated:

func ApPar

func ApPar[GB ~func() B, GAB ~func() func(A) B, GA ~func() A, B, A any](ma GA) func(GAB) GB

func ApSecond deprecated

func ApSecond[GA ~func() A, GB ~func() B, GBB ~func() func(B) B, A, B any](second GB) func(GA) GB

ApSecond combines two effectful actions, keeping only the result of the second.

Deprecated:

func ApSeq

func ApSeq[GB ~func() B, GAB ~func() func(A) B, GA ~func() A, B, A any](ma GA) func(GAB) GB

func Chain

func Chain[GA ~func() A, GB ~func() B, A, B any](f func(A) GB) func(GA) GB

Chain composes computations in sequence, using the return value of one computation to determine the next computation.

func ChainFirst

func ChainFirst[GA ~func() A, GB ~func() B, A, B any](f func(A) GB) func(GA) GA

ChainFirst composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.

func ChainTo

func ChainTo[GA ~func() A, GB ~func() B, A, B any](fb GB) func(GA) GB

ChainTo composes computations in sequence, ignoring the return value of the first computation

func Defer

func Defer[GA ~func() A, A any](gen func() GA) GA

Defer creates an IO by creating a brand new IO via a generator function, each time

func Delay

func Delay[GA ~func() A, A any](delay time.Duration) func(GA) GA

Delay creates an operation that passes in the value after some delay

func Flap

func Flap[FAB ~func(A) B, GFAB ~func() FAB, GB ~func() B, A, B any](a A) func(GFAB) GB

func Flatten

func Flatten[GA ~func() A, GAA ~func() GA, A any](mma GAA) GA

func FromIO

func FromIO[GA ~func() A, A any](a GA) GA

func FromImpure

func FromImpure[GA ~func() any, IMP ~func()](f IMP) GA

FromImpure converts a side effect without a return value into a side effect that returns any

func MakeIO

func MakeIO[GA ~func() A, A any](f func() A) GA

func Map

func Map[GA ~func() A, GB ~func() B, A, B any](f func(A) B) func(GA) GB

func MapTo

func MapTo[GA ~func() A, GB ~func() B, A, B any](b B) func(GA) GB

func Memoize

func Memoize[GA ~func() A, A any](ma GA) GA

Memoize computes the value of the provided IO monad lazily but exactly once

func MonadAp deprecated

func MonadAp[GA ~func() A, GB ~func() B, GAB ~func() func(A) B, A, B any](mab GAB, ma GA) GB

MonadAp implements the `ap` operation. Depending on a feature flag this will be sequential or parallel, the preferred implementation is parallel

Deprecated:

func MonadApFirst deprecated

func MonadApFirst[GA ~func() A, GB ~func() B, GBA ~func() func(B) A, A, B any](first GA, second GB) GA

MonadApFirst combines two effectful actions, keeping only the result of the first.

Deprecated:

func MonadApFirstPar deprecated

func MonadApFirstPar[GA ~func() A, GB ~func() B, GBA ~func() func(B) A, A, B any](first GA, second GB) GA

MonadApFirstPar combines two effectful actions, keeping only the result of the first.

Deprecated:

func MonadApFirstSeq deprecated

func MonadApFirstSeq[GA ~func() A, GB ~func() B, GBA ~func() func(B) A, A, B any](first GA, second GB) GA

MonadApFirstSeq combines two effectful actions, keeping only the result of the first.

Deprecated:

func MonadApPar deprecated

func MonadApPar[GA ~func() A, GB ~func() B, GAB ~func() func(A) B, A, B any](mab GAB, ma GA) GB

MonadApPar implements the applicative on two threads, the main thread executes mab and the actuall apply operation and the second thread computes ma. Communication between the threads happens via a channel

Deprecated:

func MonadApSecond deprecated

func MonadApSecond[GA ~func() A, GB ~func() B, GBB ~func() func(B) B, A, B any](first GA, second GB) GB

MonadApSecond combines two effectful actions, keeping only the result of the second.

Deprecated:

func MonadApSeq deprecated

func MonadApSeq[GA ~func() A, GB ~func() B, GAB ~func() func(A) B, A, B any](mab GAB, ma GA) GB

Deprecated: MonadApSeq implements the applicative on a single thread by first executing mab and the ma

func MonadChain

func MonadChain[GA ~func() A, GB ~func() B, A, B any](fa GA, f func(A) GB) GB

MonadChain composes computations in sequence, using the return value of one computation to determine the next computation.

func MonadChainFirst

func MonadChainFirst[GA ~func() A, GB ~func() B, A, B any](fa GA, f func(A) GB) GA

MonadChainFirst composes computations in sequence, using the return value of one computation to determine the next computation and keeping only the result of the first.

func MonadChainTo

func MonadChainTo[GA ~func() A, GB ~func() B, A, B any](fa GA, fb GB) GB

MonadChainTo composes computations in sequence, ignoring the return value of the first computation

func MonadFlap

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

func MonadMap

func MonadMap[GA ~func() A, GB ~func() B, A, B any](fa GA, f func(A) B) GB

func MonadMapTo

func MonadMapTo[GA ~func() A, GB ~func() B, A, B any](fa GA, b B) GB

func MonadOf

func MonadOf[GA ~func() A, A any](a A) GA

func Now

func Now[GA ~func() time.Time]() GA

Now returns the current timestamp

func Of

func Of[GA ~func() A, A any](a A) GA

func WithDuration

func WithDuration[GTA ~func() P.Pair[time.Duration, A], GA ~func() A, A any](a GA) GTA

WithDuration returns an operation that measures the duration of the operation

func WithTime

func WithTime[GTA ~func() T.Tuple3[A, time.Time, time.Time], GA ~func() A, A any](a GA) GTA

WithTime returns an operation that measures the start and end timestamp of the operation

Types

This section is empty.

Jump to

Keyboard shortcuts

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