Documentation
¶
Index ¶
- func Ap[GRB ~func(context.Context) GIOB, GRAB ~func(context.Context) GIOAB, ...](fa GRA) func(GRAB) GRB
- func Ask[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, context.Context]]() GRA
- func Asks[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) A, ...](r GRB) GRA
- func Chain[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](f func(A) GRB) func(GRA) GRB
- func ChainEitherK[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](f func(A) E.Either[error, B]) func(ma GRA) GRB
- func ChainFirst[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](f func(A) GRB) func(GRA) GRA
- func ChainFirstEitherK[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A, B any](f func(A) E.Either[error, B]) func(ma GRA) GRA
- func ChainFirstIOK[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], ...](f func(A) GIO) func(ma GRA) GRA
- func ChainIOEitherK[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](f func(A) GIOB) func(ma GRA) GRB
- func ChainIOK[GRB ~func(context.Context) GIOB, GRA ~func(context.Context) GIOA, ...](f func(A) GIO) func(ma GRA) GRB
- func ChainOptionK[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](onNone func() error) func(func(A) O.Option[B]) func(GRA) GRB
- func Defer[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](gen func() GRA) GRA
- func Delay[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](delay time.Duration) func(ma GRA) GRA
- func Eitherize0[GRA ~func(context.Context) GIOA, F ~func(context.Context) (R, error), ...](f F) func() GRA
- func Eitherize1[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0) (R, error), ...](f F) func(T0) GRA
- func Eitherize10[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) GRA
- func Eitherize2[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1) (R, error), ...](f F) func(T0, T1) GRA
- func Eitherize3[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2) GRA
- func Eitherize4[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2, T3) GRA
- func Eitherize5[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2, T3, T4) GRA
- func Eitherize6[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2, T3, T4, T5) GRA
- func Eitherize7[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2, T3, T4, T5, T6) GRA
- func Eitherize8[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2, T3, T4, T5, T6, T7) GRA
- func Eitherize9[GRA ~func(context.Context) GIOA, ...](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8) GRA
- func Eq[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](eq EQ.Eq[E.Either[error, A]]) func(context.Context) EQ.Eq[GRA]
- func Fold[GRB ~func(context.Context) GIOB, GRA ~func(context.Context) GIOA, ...](onLeft func(error) GRB, onRight func(A) GRB) func(GRA) GRB
- func FromEither[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](e E.Either[error, A]) GRA
- func FromIO[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], ...](t GIOB) GRA
- func FromIOEither[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](t GIOA) GRA
- func FromPredicate[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](pred func(A) bool, onFalse func(A) error) func(A) GRA
- func FromReader[GRA ~func(context.Context) GIOA, GR ~func(context.Context) A, ...](r GR) GRA
- func GetOrElse[GRB ~func(context.Context) GIOB, GRA ~func(context.Context) GIOA, ...](onLeft func(error) GRB) func(GRA) GRB
- func Left[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](l error) GRA
- func LeftReader[GRA ~func(context.Context) GIOA, GR ~func(context.Context) error, ...](l GR) GRA
- func Map[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](f func(A) B) func(GRA) GRB
- func MonadAp[GRB ~func(context.Context) GIOB, GRA ~func(context.Context) GIOA, ...](fab GRAB, fa GRA) GRB
- func MonadChain[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](ma GRA, f func(A) GRB) GRB
- func MonadChainEitherK[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](ma GRA, f func(A) E.Either[error, B]) GRB
- func MonadChainFirst[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](ma GRA, f func(A) GRB) GRA
- func MonadChainFirstEitherK[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A, B any](ma GRA, f func(A) E.Either[error, B]) GRA
- func MonadChainFirstIOK[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], ...](ma GRA, f func(A) GIO) GRA
- func MonadChainIOK[GRB ~func(context.Context) GIOB, GRA ~func(context.Context) GIOA, ...](ma GRA, f func(A) GIO) GRB
- func MonadMap[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](fa GRA, f func(A) B) GRB
- func Never[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any]() GRA
- func Of[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](a A) GRA
- func OrElse[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](onLeft func(error) GRA) func(GRA) GRA
- func OrLeft[GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, ...](onLeft func(error) GRB) func(GRA) GRA
- func Right[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](r A) GRA
- func RightReader[GRA ~func(context.Context) GIOA, GR ~func(context.Context) A, ...](r GR) GRA
- func SequenceArray[AS ~[]A, GAS ~[]GRA, GRAS ~func(context.Context) GIOAS, ...](ma GAS) GRAS
- func SequenceRecord[K comparable, AS ~map[K]A, GAS ~map[K]GRA, GRAS ~func(context.Context) GIOAS, ...](ma GAS) GRAS
- func SequenceT1[GRT ~func(context.Context) GIOT, GRA ~func(context.Context) GIOA, ...](a GRA) GRT
- func SequenceT2[GRT ~func(context.Context) GIOT, GRA ~func(context.Context) GIOA, ...](a GRA, b GRB) GRT
- func SequenceT3[GRT ~func(context.Context) GIOT, GRA ~func(context.Context) GIOA, ...](a GRA, b GRB, c GRC) GRT
- func SequenceT4[GRT ~func(context.Context) GIOT, GRA ~func(context.Context) GIOA, ...](a GRA, b GRB, c GRC, d GRD) GRT
- func Timer[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, time.Time]](delay time.Duration) GRA
- func TraverseArray[AS ~[]A, GRBS ~func(context.Context) GIOBS, GRB ~func(context.Context) GIOB, ...](f func(A) GRB) func(AS) GRBS
- func TraverseRecord[K comparable, AS ~map[K]A, GRBS ~func(context.Context) GIOBS, ...](f func(A) GRB) func(AS) GRBS
- func TryCatch[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](f func(context.Context) func() (A, error)) GRA
- func WithContext[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](ma GRA) GRA
- func WithResource[GRA ~func(context.Context) GIOA, GRR ~func(context.Context) GIOR, ...](onCreate GRR, onRelease func(R) GRANY) func(func(R) GRA) GRA
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainEitherK ¶
func ChainFirst ¶
func ChainFirstEitherK ¶
func ChainFirstIOK ¶
func ChainIOEitherK ¶
func ChainOptionK ¶
func Defer ¶
func Defer[ GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](gen func() GRA) GRA
Defer creates an IO by creating a brand new IO via a generator function, each time
func Delay ¶
func Delay[ GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](delay time.Duration) func(ma GRA) GRA
Delay creates an operation that passes in the value after some delay
func Eitherize0 ¶
func Eitherize0[GRA ~func(context.Context) GIOA, F ~func(context.Context) (R, error), GIOA ~func() E.Either[error, R], R any](f F) func() GRA
Eitherize0 converts a function with 0 parameters returning a tuple into a function with 0 parameters returning a [GRA] The inverse function is [Uneitherize0]
func Eitherize1 ¶
func Eitherize1[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0) (R, error), GIOA ~func() E.Either[error, R], T0, R any](f F) func(T0) GRA
Eitherize1 converts a function with 1 parameters returning a tuple into a function with 1 parameters returning a [GRA] The inverse function is [Uneitherize1]
func Eitherize10 ¶
func Eitherize10[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) GRA
Eitherize10 converts a function with 10 parameters returning a tuple into a function with 10 parameters returning a [GRA] The inverse function is [Uneitherize10]
func Eitherize2 ¶
func Eitherize2[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1) (R, error), GIOA ~func() E.Either[error, R], T0, T1, R any](f F) func(T0, T1) GRA
Eitherize2 converts a function with 2 parameters returning a tuple into a function with 2 parameters returning a [GRA] The inverse function is [Uneitherize2]
func Eitherize3 ¶
func Eitherize3[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, R any](f F) func(T0, T1, T2) GRA
Eitherize3 converts a function with 3 parameters returning a tuple into a function with 3 parameters returning a [GRA] The inverse function is [Uneitherize3]
func Eitherize4 ¶
func Eitherize4[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, R any](f F) func(T0, T1, T2, T3) GRA
Eitherize4 converts a function with 4 parameters returning a tuple into a function with 4 parameters returning a [GRA] The inverse function is [Uneitherize4]
func Eitherize5 ¶
func Eitherize5[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, R any](f F) func(T0, T1, T2, T3, T4) GRA
Eitherize5 converts a function with 5 parameters returning a tuple into a function with 5 parameters returning a [GRA] The inverse function is [Uneitherize5]
func Eitherize6 ¶
func Eitherize6[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, R any](f F) func(T0, T1, T2, T3, T4, T5) GRA
Eitherize6 converts a function with 6 parameters returning a tuple into a function with 6 parameters returning a [GRA] The inverse function is [Uneitherize6]
func Eitherize7 ¶
func Eitherize7[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, R any](f F) func(T0, T1, T2, T3, T4, T5, T6) GRA
Eitherize7 converts a function with 7 parameters returning a tuple into a function with 7 parameters returning a [GRA] The inverse function is [Uneitherize7]
func Eitherize8 ¶
func Eitherize8[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6, T7) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7) GRA
Eitherize8 converts a function with 8 parameters returning a tuple into a function with 8 parameters returning a [GRA] The inverse function is [Uneitherize8]
func Eitherize9 ¶
func Eitherize9[GRA ~func(context.Context) GIOA, F ~func(context.Context, T0, T1, T2, T3, T4, T5, T6, T7, T8) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8) GRA
Eitherize9 converts a function with 9 parameters returning a tuple into a function with 9 parameters returning a [GRA] The inverse function is [Uneitherize9]
func Eq ¶
func Eq[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](eq EQ.Eq[E.Either[error, A]]) func(context.Context) EQ.Eq[GRA]
Eq implements the equals predicate for values contained in the IOEither monad
func FromEither ¶
func FromIOEither ¶
func FromPredicate ¶
func FromReader ¶
func LeftReader ¶
func MonadAp ¶
func MonadAp[ GRB ~func(context.Context) GIOB, GRA ~func(context.Context) GIOA, GRAB ~func(context.Context) GIOAB, GIOA ~func() E.Either[error, A], GIOB ~func() E.Either[error, B], GIOAB ~func() E.Either[error, func(A) B], A, B any](fab GRAB, fa GRA) GRB
MonadAp implements the `Ap` function for a reader with context. It creates a sub-context that will be canceled if any of the input operations errors out or
func MonadChain ¶
func MonadChainEitherK ¶
func MonadChainFirst ¶
func MonadChainFirstEitherK ¶
func MonadChainFirstIOK ¶
func MonadChainIOK ¶
func Never ¶
Never returns a 'ReaderIOEither' that never returns, except if its context gets canceled
func RightReader ¶
func SequenceArray ¶
func SequenceArray[ AS ~[]A, GAS ~[]GRA, GRAS ~func(context.Context) GIOAS, GRA ~func(context.Context) GIOA, GIOAS ~func() E.Either[error, AS], GIOA ~func() E.Either[error, A], A any](ma GAS) GRAS
SequenceArray converts a homogeneous sequence of either into an either of sequence
func SequenceRecord ¶
func SequenceRecord[K comparable, AS ~map[K]A, GAS ~map[K]GRA, GRAS ~func(context.Context) GIOAS, GRA ~func(context.Context) GIOA, GIOAS ~func() E.Either[error, AS], GIOA ~func() E.Either[error, A], A any](ma GAS) GRAS
SequenceRecord converts a homogeneous sequence of either into an either of sequence
func SequenceT1 ¶
func SequenceT2 ¶
func SequenceT3 ¶
func SequenceT3[ GRT ~func(context.Context) GIOT, GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, GRC ~func(context.Context) GIOC, GIOA ~func() E.Either[error, A], GIOB ~func() E.Either[error, B], GIOC ~func() E.Either[error, C], GIOT ~func() E.Either[error, T.Tuple3[A, B, C]], A, B, C any](a GRA, b GRB, c GRC) GRT
func SequenceT4 ¶
func SequenceT4[ GRT ~func(context.Context) GIOT, GRA ~func(context.Context) GIOA, GRB ~func(context.Context) GIOB, GRC ~func(context.Context) GIOC, GRD ~func(context.Context) GIOD, GIOA ~func() E.Either[error, A], GIOB ~func() E.Either[error, B], GIOC ~func() E.Either[error, C], GIOD ~func() E.Either[error, D], GIOT ~func() E.Either[error, T.Tuple4[A, B, C, D]], A, B, C, D any](a GRA, b GRB, c GRC, d GRD) GRT
func Timer ¶
func Timer[ GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, time.Time], ](delay time.Duration) GRA
Timer will return the current time after an initial delay
func TraverseArray ¶
func TraverseArray[ AS ~[]A, GRBS ~func(context.Context) GIOBS, GRB ~func(context.Context) GIOB, GIOBS ~func() E.Either[error, BS], GIOB ~func() E.Either[error, B], BS ~[]B, A, B any](f func(A) GRB) func(AS) GRBS
TraverseArray transforms an array
func TraverseRecord ¶
func TraverseRecord[K comparable, AS ~map[K]A, GRBS ~func(context.Context) GIOBS, GRB ~func(context.Context) GIOB, GIOBS ~func() E.Either[error, BS], GIOB ~func() E.Either[error, B], BS ~map[K]B, A, B any](f func(A) GRB) func(AS) GRBS
TraverseRecord transforms a record
func TryCatch ¶
func TryCatch[ GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](f func(context.Context) func() (A, error)) GRA
TryCatch wraps a reader returning a tuple as an error into ReaderIOEither
func WithContext ¶
func WithContext[GRA ~func(context.Context) GIOA, GIOA ~func() E.Either[error, A], A any](ma GRA) GRA
withContext wraps an existing ReaderIOEither and performs a context check for cancellation before delegating
func WithResource ¶
func WithResource[ GRA ~func(context.Context) GIOA, GRR ~func(context.Context) GIOR, GRANY ~func(context.Context) GIOANY, GIOR ~func() E.Either[error, R], GIOA ~func() E.Either[error, A], GIOANY ~func() E.Either[error, ANY], R, A, ANY any](onCreate GRR, onRelease func(R) GRANY) func(func(R) GRA) GRA
WithResource constructs a function that creates a resource, then operates on it and then releases the resource
Types ¶
This section is empty.