generic

package
v2.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Code generated by go generate; DO NOT EDIT. This file was generated by robots at 2025-03-09 23:53:13.781616 +0100 CET m=+0.026181001

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alt deprecated

func Alt[LAZY ~func() GEA, GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](second LAZY) func(GEA) GEA

Deprecated:

func Ap deprecated

func Ap[
	GEA ~func(R) GIOA,
	GEB ~func(R) GIOB,
	GEFAB ~func(R) GIOFAB,
	GIOA ~func() either.Either[E, A],
	GIOB ~func() either.Either[E, B],
	GIOFAB ~func() either.Either[E, func(A) B],
	R, E, A, B any](fa GEA) func(fab GEFAB) GEB

Deprecated:

func ApPar deprecated

func ApPar[
	GEA ~func(R) GIOA,
	GEB ~func(R) GIOB,
	GEFAB ~func(R) GIOFAB,
	GIOA ~func() either.Either[E, A],
	GIOB ~func() either.Either[E, B],
	GIOFAB ~func() either.Either[E, func(A) B],
	R, E, A, B any](fa GEA) func(fab GEFAB) GEB

Deprecated:

func ApS

func ApS[GRTS1 ~func(R) GTS1, GRS1 ~func(R) GS1, GRS2 ~func(R) GS2, GRT ~func(R) GT, GTS1 ~func() either.Either[E, func(T) S2], GS1 ~func() either.Either[E, S1], GS2 ~func() either.Either[E, S2], GT ~func() either.Either[E, T], R, E, S1, S2, T any](
	setter func(T) func(S1) S2,
	fa GRT,
) func(GRS1) GRS2

ApS attaches a value to a context [S1] to produce a context [S2] by considering the context and the value concurrently (using Applicative rather than Monad). This allows independent computations to be combined without one depending on the result of the other.

Unlike Bind, which sequences operations, ApS can be used when operations are independent and can conceptually run in parallel.

Example:

type State struct {
    User   User
    Config Config
}
type Env struct {
    UserRepo   UserRepository
    ConfigRepo ConfigRepository
}

// These operations are independent and can be combined with ApS
getUser := func(env Env) ioeither.IOEither[error, User] {
    return env.UserRepo.FindUser()
}
getConfig := func(env Env) ioeither.IOEither[error, Config] {
    return env.ConfigRepo.LoadConfig()
}

result := F.Pipe2(
    generic.Do[ReaderIOEither[Env, error, State], IOEither[error, State], Env, error, State](State{}),
    generic.ApS[...](
        func(user User) func(State) State {
            return func(s State) State { s.User = user; return s }
        },
        getUser,
    ),
    generic.ApS[...](
        func(cfg Config) func(State) State {
            return func(s State) State { s.Config = cfg; return s }
        },
        getConfig,
    ),
)

func ApSeq deprecated

func ApSeq[
	GEA ~func(R) GIOA,
	GEB ~func(R) GIOB,
	GEFAB ~func(R) GIOFAB,
	GIOA ~func() either.Either[E, A],
	GIOB ~func() either.Either[E, B],
	GIOFAB ~func() either.Either[E, func(A) B],
	R, E, A, B any](fa GEA) func(fab GEFAB) GEB

Deprecated:

func Ask deprecated

func Ask[GER ~func(R) GIOR, GIOR ~func() either.Either[E, R], R, E any]() GER

Deprecated:

func Asks deprecated

func Asks[GA ~func(R) A, GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](r GA) GEA

Deprecated:

func BiMap

func BiMap[GA ~func(R) GE1A, GB ~func(R) GE2B, GE1A ~func() either.Either[E1, A], GE2B ~func() either.Either[E2, B], R, E1, E2, A, B any](f func(E1) E2, g func(A) B) func(GA) GB

BiMap maps a pair of functions over the two type arguments of the bifunctor. Deprecated:

func Bind

func Bind[GRS1 ~func(R) GS1, GRS2 ~func(R) GS2, GRT ~func(R) GT, GS1 ~func() either.Either[E, S1], GS2 ~func() either.Either[E, S2], GT ~func() either.Either[E, T], R, E, S1, S2, T any](
	setter func(T) func(S1) S2,
	f func(S1) GRT,
) func(GRS1) GRS2

Bind attaches the result of a computation to a context [S1] to produce a context [S2]. This enables sequential composition where each step can depend on the results of previous steps and access the shared environment.

The setter function takes the result of the computation and returns a function that updates the context from S1 to S2.

Example:

type State struct {
    User   User
    Config Config
}
type Env struct {
    UserRepo   UserRepository
    ConfigRepo ConfigRepository
}

result := F.Pipe2(
    generic.Do[ReaderIOEither[Env, error, State], IOEither[error, State], Env, error, State](State{}),
    generic.Bind[ReaderIOEither[Env, error, State], ReaderIOEither[Env, error, State], ReaderIOEither[Env, error, User], IOEither[error, State], IOEither[error, State], IOEither[error, User], Env, error, State, State, User](
        func(user User) func(State) State {
            return func(s State) State { s.User = user; return s }
        },
        func(s State) ReaderIOEither[Env, error, User] {
            return func(env Env) ioeither.IOEither[error, User] {
                return env.UserRepo.FindUser()
            }
        },
    ),
    generic.Bind[ReaderIOEither[Env, error, State], ReaderIOEither[Env, error, State], ReaderIOEither[Env, error, Config], IOEither[error, State], IOEither[error, State], IOEither[error, Config], Env, error, State, State, Config](
        func(cfg Config) func(State) State {
            return func(s State) State { s.Config = cfg; return s }
        },
        func(s State) ReaderIOEither[Env, error, Config] {
            // This can access s.User from the previous step
            return func(env Env) ioeither.IOEither[error, Config] {
                return env.ConfigRepo.LoadConfigForUser(s.User.ID)
            }
        },
    ),
)

func BindTo

func BindTo[GRS1 ~func(R) GS1, GRT ~func(R) GT, GS1 ~func() either.Either[E, S1], GT ~func() either.Either[E, T], R, E, S1, T any](
	setter func(T) S1,
) func(GRT) GRS1

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

func Bracket

func Bracket[
	GA ~func(R) TA,
	GB ~func(R) TB,
	GANY ~func(R) TANY,

	TA ~func() either.Either[E, A],
	TB ~func() either.Either[E, B],
	TANY ~func() either.Either[E, ANY],

	R, E, A, B, ANY any](

	acquire GA,
	use func(A) GB,
	release func(A, either.Either[E, B]) GANY,
) GB

Bracket makes sure that a resource is cleaned up in the event of an error. The release action is called regardless of whether the body action returns and error or not.

func Chain deprecated

func Chain[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](f func(A) GEB) func(fa GEA) GEB

Deprecated:

func ChainEitherK deprecated

func ChainEitherK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](f func(A) either.Either[E, B]) func(ma GEA) GEB

Deprecated:

func ChainFirst deprecated

func ChainFirst[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](f func(A) GEB) func(fa GEA) GEA

Deprecated:

func ChainFirstEitherK deprecated

func ChainFirstEitherK[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A, B any](f func(A) either.Either[E, B]) func(ma GEA) GEA

Deprecated:

func ChainFirstIOK deprecated

func ChainFirstIOK[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GIO ~func() B, R, E, A, B any](f func(A) GIO) func(GEA) GEA

Deprecated:

func ChainIOEitherK deprecated

func ChainIOEitherK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](f func(A) GIOB) func(GEA) GEB

Deprecated:

func ChainIOK deprecated

func ChainIOK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], GIO ~func() B, R, E, A, B any](f func(A) GIO) func(GEA) GEB

Deprecated:

func ChainOptionK deprecated

func ChainOptionK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](onNone func() E) func(func(A) O.Option[B]) func(GEA) GEB

Deprecated:

func ChainReaderIOK deprecated

func ChainReaderIOK[GEA ~func(R) GIOEA, GEB ~func(R) GIOEB, GIOEA ~func() either.Either[E, A], GIOEB ~func() either.Either[E, B], GIOB ~func() B, GB ~func(R) GIOB, R, E, A, B any](f func(A) GB) func(GEA) GEB

Deprecated:

func ChainReaderK deprecated

func ChainReaderK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], GB ~func(R) B, R, E, A, B any](f func(A) GB) func(GEA) GEB

Deprecated:

func Defer

func Defer[GEA ~func(R) GA, GA ~func() either.Either[E, A], R, E, A any](gen func() GEA) GEA

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

func Do

func Do[GRS ~func(R) GS, GS ~func() either.Either[E, S], R, E, S any](
	empty S,
) GRS

Do creates an empty context of type [S] to be used with the Bind operation. This is the starting point for do-notation style composition.

Example:

type State struct {
    User   User
    Config Config
}
type Env struct {
    UserRepo   UserRepository
    ConfigRepo ConfigRepository
}
result := generic.Do[ReaderIOEither[Env, error, State], IOEither[error, State], Env, error, State](State{})

func Eitherize0

func Eitherize0[GRA ~func(C) GIOA, F ~func(C) (R, error), GIOA ~func() E.Either[error, R], C, 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 first parameter is considered to be the context [C].

func Eitherize1

func Eitherize1[GRA ~func(C) GIOA, F ~func(C, T0) (R, error), GIOA ~func() E.Either[error, R], T0, C, 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 first parameter is considered to be the context [C].

func Eitherize10

func Eitherize10[GRA ~func(C) GIOA, F ~func(C, 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, C, 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 first parameter is considered to be the context [C].

func Eitherize2

func Eitherize2[GRA ~func(C) GIOA, F ~func(C, T0, T1) (R, error), GIOA ~func() E.Either[error, R], T0, T1, C, 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 first parameter is considered to be the context [C].

func Eitherize3

func Eitherize3[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, C, 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 first parameter is considered to be the context [C].

func Eitherize4

func Eitherize4[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, C, 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 first parameter is considered to be the context [C].

func Eitherize5

func Eitherize5[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, C, 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 first parameter is considered to be the context [C].

func Eitherize6

func Eitherize6[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, C, 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 first parameter is considered to be the context [C].

func Eitherize7

func Eitherize7[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, C, 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 first parameter is considered to be the context [C].

func Eitherize8

func Eitherize8[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, C, 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 first parameter is considered to be the context [C].

func Eitherize9

func Eitherize9[GRA ~func(C) GIOA, F ~func(C, 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, C, 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 first parameter is considered to be the context [C].

func Flap deprecated

func Flap[GREAB ~func(R) GEAB, GREB ~func(R) GEB, GEAB ~func() either.Either[E, func(A) B], GEB ~func() either.Either[E, B], R, E, B, A any](a A) func(GREAB) GREB

Deprecated:

func Flatten deprecated

func Flatten[GEA ~func(R) GIOA, GGEA ~func(R) GIOEA, GIOA ~func() either.Either[E, A], GIOEA ~func() either.Either[E, GEA], R, E, A any](mma GGEA) GEA

Deprecated:

func Fold deprecated

func Fold[GB ~func(R) GIOB, GEA ~func(R) GIOA, GIOB ~func() B, GIOA ~func() either.Either[E, A], R, E, A, B any](onLeft func(E) GB, onRight func(A) GB) func(GEA) GB

Deprecated:

func From0

func From0[GRA ~func(C) GIOA, F ~func(C) func() (R, error), GIOA ~func() E.Either[error, R], C, R any](f F) func() GRA

From0 converts a function with 1 parameters returning a tuple into a function with 0 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From1

func From1[GRA ~func(C) GIOA, F ~func(C, T0) func() (R, error), GIOA ~func() E.Either[error, R], T0, C, R any](f F) func(T0) GRA

From1 converts a function with 2 parameters returning a tuple into a function with 1 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From10

func From10[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) GRA

From10 converts a function with 11 parameters returning a tuple into a function with 10 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From2

func From2[GRA ~func(C) GIOA, F ~func(C, T0, T1) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, C, R any](f F) func(T0, T1) GRA

From2 converts a function with 3 parameters returning a tuple into a function with 2 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From3

func From3[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, C, R any](f F) func(T0, T1, T2) GRA

From3 converts a function with 4 parameters returning a tuple into a function with 3 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From4

func From4[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, C, R any](f F) func(T0, T1, T2, T3) GRA

From4 converts a function with 5 parameters returning a tuple into a function with 4 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From5

func From5[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, C, R any](f F) func(T0, T1, T2, T3, T4) GRA

From5 converts a function with 6 parameters returning a tuple into a function with 5 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From6

func From6[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, C, R any](f F) func(T0, T1, T2, T3, T4, T5) GRA

From6 converts a function with 7 parameters returning a tuple into a function with 6 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From7

func From7[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6) GRA

From7 converts a function with 8 parameters returning a tuple into a function with 7 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From8

func From8[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7) GRA

From8 converts a function with 9 parameters returning a tuple into a function with 8 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func From9

func From9[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) func() (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, T8, C, R any](f F) func(T0, T1, T2, T3, T4, T5, T6, T7, T8) GRA

From9 converts a function with 10 parameters returning a tuple into a function with 9 parameters returning a [GRA] The first parameter is considerd to be the context [C].

func FromEither deprecated

func FromEither[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](t either.Either[E, A]) GEA

Deprecated:

func FromIO deprecated

func FromIO[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GR ~func() A, R, E, A any](ma GR) GEA

Deprecated:

func FromIOEither deprecated

func FromIOEither[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](t GIOA) GEA

Deprecated:

func FromOption deprecated

func FromOption[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](onNone func() E) func(O.Option[A]) GEA

Deprecated:

func FromPredicate deprecated

func FromPredicate[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](pred func(A) bool, onFalse func(A) E) func(A) GEA

Deprecated:

func FromReader deprecated

func FromReader[GA ~func(R) A, GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](ma GA) GEA

Deprecated:

func FromReaderEither deprecated

func FromReaderEither[GA ~func(R) either.Either[E, A], GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](ma GA) GEA

Deprecated:

func FromReaderIO deprecated

func FromReaderIO[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GRIO ~func(R) GIO, GIO ~func() A, R, E, A any](f func(A) GRIO) func(A) GEA

Deprecated:

func Functor

func Functor[R, E, A, B any, GRA ~func(R) GIOA, GRB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B]]() functor.Functor[A, B, GRA, GRB]

Functor implements the monadic operations for [ReaderIOEither]

func GetOrElse deprecated

func GetOrElse[GA ~func(R) GIOB, GEA ~func(R) GIOA, GIOB ~func() A, GIOA ~func() either.Either[E, A], R, E, A any](onLeft func(E) GA) func(GEA) GA

Deprecated:

func Left deprecated

func Left[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](e E) GEA

Deprecated:

func LeftIO deprecated

func LeftIO[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GR ~func() E, R, E, A any](ma GR) GEA

Deprecated:

func LeftReader deprecated

func LeftReader[GE ~func(R) E, GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](ma GE) GEA

Deprecated:

func LeftReaderIO deprecated

func LeftReaderIO[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GRIO ~func(R) GIO, GIO ~func() E, R, E, A any](me GRIO) GEA

Deprecated:

func Let

func Let[GRS1 ~func(R) GS1, GRS2 ~func(R) GS2, GS1 ~func() either.Either[E, S1], GS2 ~func() either.Either[E, S2], R, E, S1, S2, T any](
	key func(T) func(S1) S2,
	f func(S1) T,
) func(GRS1) GRS2

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

func LetTo

func LetTo[GRS1 ~func(R) GS1, GRS2 ~func(R) GS2, GS1 ~func() either.Either[E, S1], GS2 ~func() either.Either[E, S2], R, E, S1, S2, B any](
	key func(B) func(S1) S2,
	b B,
) func(GRS1) GRS2

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

func Local

func Local[
	GEA1 ~func(R1) GIOA,
	GEA2 ~func(R2) GIOA,

	GIOA ~func() either.Either[E, A],
	R1, R2, E, A any,
](f func(R2) R1) func(GEA1) GEA2

Local changes the value of the local context during the execution of the action `ma` (similar to `Contravariant`'s `contramap`). Deprecated:

func MakeReader

func MakeReader[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](f func(R) GIOA) GEA

MakeReader constructs an instance of a reader Deprecated:

func Map deprecated

func Map[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](f func(A) B) func(GEA) GEB

Deprecated:

func MapLeft

func MapLeft[GREA1 ~func(R) GEA1, GREA2 ~func(R) GEA2, GEA1 ~func() either.Either[E1, A], GEA2 ~func() either.Either[E2, A], R, E1, E2, A any](f func(E1) E2) func(GREA1) GREA2

MapLeft applies a mapping function to the error channel Deprecated:

func MapTo deprecated

func MapTo[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](b B) func(GEA) GEB

Deprecated:

func Memoize

func Memoize[
	GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](rdr GEA) GEA

Memoize computes the value of the provided monad lazily but exactly once The context used to compute the value is the context of the first call, so do not use this method if the value has a functional dependency on the content of the context Deprecated:

func Monad

func Monad[R, E, A, B any, GRA ~func(R) GIOA, GRB ~func(R) GIOB, GRAB ~func(R) GIOAB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], GIOAB ~func() either.Either[E, func(A) B]]() monad.Monad[A, B, GRA, GRB, GRAB]

Monad implements the monadic operations for [ReaderIOEither]

func MonadAlt deprecated

func MonadAlt[LAZY ~func() GEA, GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](first GEA, second LAZY) GEA

Deprecated:

func MonadAp deprecated

func MonadAp[
	GEA ~func(R) GIOA,
	GEB ~func(R) GIOB,
	GEFAB ~func(R) GIOFAB,
	GIOA ~func() either.Either[E, A],
	GIOB ~func() either.Either[E, B],
	GIOFAB ~func() either.Either[E, func(A) B],
	R, E, A, B any](fab GEFAB, fa GEA) GEB

Deprecated:

func MonadApPar deprecated

func MonadApPar[
	GEA ~func(R) GIOA,
	GEB ~func(R) GIOB,
	GEFAB ~func(R) GIOFAB,
	GIOA ~func() either.Either[E, A],
	GIOB ~func() either.Either[E, B],
	GIOFAB ~func() either.Either[E, func(A) B],
	R, E, A, B any](fab GEFAB, fa GEA) GEB

Deprecated:

func MonadApSeq deprecated

func MonadApSeq[
	GEA ~func(R) GIOA,
	GEB ~func(R) GIOB,
	GEFAB ~func(R) GIOFAB,
	GIOA ~func() either.Either[E, A],
	GIOB ~func() either.Either[E, B],
	GIOFAB ~func() either.Either[E, func(A) B],
	R, E, A, B any](fab GEFAB, fa GEA) GEB

Deprecated:

func MonadBiMap deprecated

func MonadBiMap[GA ~func(R) GE1A, GB ~func(R) GE2B, GE1A ~func() either.Either[E1, A], GE2B ~func() either.Either[E2, B], R, E1, E2, A, B any](fa GA, f func(E1) E2, g func(A) B) GB

Deprecated:

func MonadChain deprecated

func MonadChain[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](fa GEA, f func(A) GEB) GEB

Deprecated:

func MonadChainEitherK deprecated

func MonadChainEitherK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](ma GEA, f func(A) either.Either[E, B]) GEB

Deprecated:

func MonadChainFirst deprecated

func MonadChainFirst[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](fa GEA, f func(A) GEB) GEA

Deprecated:

func MonadChainFirstEitherK deprecated

func MonadChainFirstEitherK[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A, B any](ma GEA, f func(A) either.Either[E, B]) GEA

Deprecated:

func MonadChainFirstIOK deprecated

func MonadChainFirstIOK[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GIO ~func() B, R, E, A, B any](ma GEA, f func(A) GIO) GEA

Deprecated:

func MonadChainIOEitherK deprecated

func MonadChainIOEitherK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](ma GEA, f func(A) GIOB) GEB

Deprecated:

func MonadChainIOK deprecated

func MonadChainIOK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], GIO ~func() B, R, E, A, B any](ma GEA, f func(A) GIO) GEB

Deprecated:

func MonadChainReaderIOK deprecated

func MonadChainReaderIOK[GEA ~func(R) GIOEA, GEB ~func(R) GIOEB, GIOEA ~func() either.Either[E, A], GIOEB ~func() either.Either[E, B], GIOB ~func() B, GB ~func(R) GIOB, R, E, A, B any](ma GEA, f func(A) GB) GEB

Deprecated:

func MonadChainReaderK deprecated

func MonadChainReaderK[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], GB ~func(R) B, R, E, A, B any](ma GEA, f func(A) GB) GEB

Deprecated:

func MonadFlap deprecated

func MonadFlap[GREAB ~func(R) GEAB, GREB ~func(R) GEB, GEAB ~func() either.Either[E, func(A) B], GEB ~func() either.Either[E, B], R, E, B, A any](fab GREAB, a A) GREB

Deprecated:

func MonadFromReaderIO deprecated

func MonadFromReaderIO[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GRIO ~func(R) GIO, GIO ~func() A, R, E, A any](a A, f func(A) GRIO) GEA

Deprecated:

func MonadMap deprecated

func MonadMap[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](fa GEA, f func(A) B) GEB

Deprecated:

func MonadMapLeft deprecated

func MonadMapLeft[GREA1 ~func(R) GEA1, GREA2 ~func(R) GEA2, GEA1 ~func() either.Either[E1, A], GEA2 ~func() either.Either[E2, A], R, E1, E2, A any](fa GREA1, f func(E1) E2) GREA2

Deprecated:

func MonadMapTo deprecated

func MonadMapTo[GEA ~func(R) GIOA, GEB ~func(R) GIOB, GIOA ~func() either.Either[E, A], GIOB ~func() either.Either[E, B], R, E, A, B any](fa GEA, b B) GEB

Deprecated:

func MonadTraverseArray

func MonadTraverseArray[GB ~func(E) GIOB, GBS ~func(E) GIOBS, GIOB ~func() either.Either[L, B], GIOBS ~func() either.Either[L, BBS], AAS ~[]A, BBS ~[]B, E, L, A, B any](ma AAS, f func(A) GB) GBS

MonadTraverseArray transforms an array

func MonadTraverseRecord

func MonadTraverseRecord[GB ~func(C) GIOB, GBS ~func(C) GIOBS, GIOB ~func() either.Either[E, B], GIOBS ~func() either.Either[E, BBS], AAS ~map[K]A, BBS ~map[K]B, K comparable, C, E, A, B any](tas AAS, f func(A) GB) GBS

MonadTraverseRecord transforms an array

func Of

func Of[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](a A) GEA

Of returns a Reader with a fixed value Deprecated:

func OrElse deprecated

func OrElse[GEA1 ~func(R) GIOA1, GEA2 ~func(R) GIOA2, GIOA1 ~func() either.Either[E1, A], GIOA2 ~func() either.Either[E2, A], R, E1, A, E2 any](onLeft func(E1) GEA2) func(GEA1) GEA2

Deprecated:

func OrLeft deprecated

func OrLeft[GEA1 ~func(R) GIOA1, GE2 ~func(R) GIOE2, GEA2 ~func(R) GIOA2, GIOA1 ~func() either.Either[E1, A], GIOE2 ~func() E2, GIOA2 ~func() either.Either[E2, A], E1, R, E2, A any](onLeft func(E1) GE2) func(GEA1) GEA2

Deprecated:

func Pointed

func Pointed[R, E, A any, GRA ~func(R) GIOA, GIOA ~func() either.Either[E, A]]() pointed.Pointed[A, GRA]

Pointed implements the pointed operations for [ReaderIOEither]

func Right[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](a A) GEA

Deprecated:

func RightIO deprecated

func RightIO[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GR ~func() A, R, E, A any](ma GR) GEA

Deprecated:

func RightReader deprecated

func RightReader[GA ~func(R) A, GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](ma GA) GEA

Deprecated:

func RightReaderIO deprecated

func RightReaderIO[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], GRIO ~func(R) GIO, GIO ~func() A, R, E, A any](ma GRIO) GEA

Deprecated:

func SequenceArray

func SequenceArray[GA ~func(E) GIOA, GAS ~func(E) GIOAS, GIOA ~func() either.Either[L, A], GIOAS ~func() either.Either[L, AAS], AAS ~[]A, GAAS ~[]GA, E, L, A any](ma GAAS) GAS

SequenceArray converts a homogeneous sequence of either into an either of sequence

func SequenceRecord

func SequenceRecord[GA ~func(C) GIOA, GAS ~func(C) GIOAS, GIOA ~func() either.Either[E, A], GIOAS ~func() either.Either[E, AAS], AAS ~map[K]A, GAAS ~map[K]GA, K comparable, C, E, A any](tas GAAS) GAS

SequenceRecord converts a homogeneous sequence of either into an either of sequence

func SequenceT1

func SequenceT1[
	GA ~func(E) GIOA,
	GTA ~func(E) GIOTA,
	GIOA ~func() either.Either[L, A],
	GIOTA ~func() either.Either[L, T.Tuple1[A]],
	E, L, A any](a GA) GTA

func SequenceT2

func SequenceT2[
	GA ~func(E) GIOA,
	GB ~func(E) GIOB,
	GTAB ~func(E) GIOTAB,
	GIOA ~func() either.Either[L, A],
	GIOB ~func() either.Either[L, B],
	GIOTAB ~func() either.Either[L, T.Tuple2[A, B]],
	E, L, A, B any](a GA, b GB) GTAB

func SequenceT3

func SequenceT3[
	GA ~func(E) GIOA,
	GB ~func(E) GIOB,
	GC ~func(E) GIOC,
	GTABC ~func(E) GIOTABC,
	GIOA ~func() either.Either[L, A],
	GIOB ~func() either.Either[L, B],
	GIOC ~func() either.Either[L, C],
	GIOTABC ~func() either.Either[L, T.Tuple3[A, B, C]],
	E, L, A, B, C any](a GA, b GB, c GC) GTABC

func SequenceT4

func SequenceT4[
	GA ~func(E) GIOA,
	GB ~func(E) GIOB,
	GC ~func(E) GIOC,
	GD ~func(E) GIOD,
	GTABCD ~func(E) GIOTABCD,
	GIOA ~func() either.Either[L, A],
	GIOB ~func() either.Either[L, B],
	GIOC ~func() either.Either[L, C],
	GIOD ~func() either.Either[L, D],
	GIOTABCD ~func() either.Either[L, T.Tuple4[A, B, C, D]],
	E, L, A, B, C, D any](a GA, b GB, c GC, d GD) GTABCD

func Swap

func Swap[GREA ~func(R) GEA, GRAE ~func(R) GAE, GEA ~func() either.Either[E, A], GAE ~func() either.Either[A, E], R, E, A any](val GREA) GRAE

Swap changes the order of type parameters Deprecated:

func ThrowError deprecated

func ThrowError[GEA ~func(R) GIOA, GIOA ~func() either.Either[E, A], R, E, A any](e E) GEA

Deprecated:

func TraverseArray

func TraverseArray[GB ~func(E) GIOB, GBS ~func(E) GIOBS, GIOB ~func() either.Either[L, B], GIOBS ~func() either.Either[L, BBS], AAS ~[]A, BBS ~[]B, E, L, A, B any](f func(A) GB) func(AAS) GBS

TraverseArray transforms an array

func TraverseArrayWithIndex

func TraverseArrayWithIndex[GB ~func(E) GIOB, GBS ~func(E) GIOBS, GIOB ~func() either.Either[L, B], GIOBS ~func() either.Either[L, BBS], AAS ~[]A, BBS ~[]B, E, L, A, B any](f func(int, A) GB) func(AAS) GBS

TraverseArrayWithIndex transforms an array

func TraverseRecord

func TraverseRecord[GB ~func(C) GIOB, GBS ~func(C) GIOBS, GIOB ~func() either.Either[E, B], GIOBS ~func() either.Either[E, BBS], AAS ~map[K]A, BBS ~map[K]B, K comparable, C, E, A, B any](f func(A) GB) func(AAS) GBS

TraverseRecord transforms a record

func TraverseRecordWithIndex

func TraverseRecordWithIndex[GB ~func(C) GIOB, GBS ~func(C) GIOBS, GIOB ~func() either.Either[E, B], GIOBS ~func() either.Either[E, BBS], AAS ~map[K]A, BBS ~map[K]B, K comparable, C, E, A, B any](f func(K, A) GB) func(AAS) GBS

TraverseRecordWithIndex transforms a record

func TryCatch

func TryCatch[GEA ~func(R) GA, GA ~func() either.Either[E, A], R, E, A any](f func(R) func() (A, error), onThrow func(error) E) GEA

TryCatch wraps a reader returning a tuple as an error into ReaderIOEither Deprecated:

func Uneitherize0

func Uneitherize0[GRA ~func(C) GIOA, F ~func(C) (R, error), GIOA ~func() E.Either[error, R], C, R any](f func() GRA) F

Uneitherize0 converts a function with 0 parameters returning a [GRA] into a function with 0 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize1

func Uneitherize1[GRA ~func(C) GIOA, F ~func(C, T0) (R, error), GIOA ~func() E.Either[error, R], T0, C, R any](f func(T0) GRA) F

Uneitherize1 converts a function with 1 parameters returning a [GRA] into a function with 1 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize10

func Uneitherize10[GRA ~func(C) GIOA, F ~func(C, 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, C, R any](f func(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) GRA) F

Uneitherize10 converts a function with 10 parameters returning a [GRA] into a function with 10 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize2

func Uneitherize2[GRA ~func(C) GIOA, F ~func(C, T0, T1) (R, error), GIOA ~func() E.Either[error, R], T0, T1, C, R any](f func(T0, T1) GRA) F

Uneitherize2 converts a function with 2 parameters returning a [GRA] into a function with 2 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize3

func Uneitherize3[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, C, R any](f func(T0, T1, T2) GRA) F

Uneitherize3 converts a function with 3 parameters returning a [GRA] into a function with 3 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize4

func Uneitherize4[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, C, R any](f func(T0, T1, T2, T3) GRA) F

Uneitherize4 converts a function with 4 parameters returning a [GRA] into a function with 4 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize5

func Uneitherize5[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, C, R any](f func(T0, T1, T2, T3, T4) GRA) F

Uneitherize5 converts a function with 5 parameters returning a [GRA] into a function with 5 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize6

func Uneitherize6[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, C, R any](f func(T0, T1, T2, T3, T4, T5) GRA) F

Uneitherize6 converts a function with 6 parameters returning a [GRA] into a function with 6 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize7

func Uneitherize7[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, C, R any](f func(T0, T1, T2, T3, T4, T5, T6) GRA) F

Uneitherize7 converts a function with 7 parameters returning a [GRA] into a function with 7 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize8

func Uneitherize8[GRA ~func(C) GIOA, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) (R, error), GIOA ~func() E.Either[error, R], T0, T1, T2, T3, T4, T5, T6, T7, C, R any](f func(T0, T1, T2, T3, T4, T5, T6, T7) GRA) F

Uneitherize8 converts a function with 8 parameters returning a [GRA] into a function with 8 parameters returning a tuple. The first parameter is considered to be the context [C].

func Uneitherize9

func Uneitherize9[GRA ~func(C) GIOA, F ~func(C, 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, C, R any](f func(T0, T1, T2, T3, T4, T5, T6, T7, T8) GRA) F

Uneitherize9 converts a function with 9 parameters returning a [GRA] into a function with 9 parameters returning a tuple. The first parameter is considered to be the context [C].

Types

This section is empty.

Jump to

Keyboard shortcuts

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