Help us shape the future of Go! Take the 2026 Go Developer Survey

generic

package
v1.1.84 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: 7 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT. This file was generated by robots at 2024-02-29 16:19:26.0521202 +0100 CET m=+0.018000401

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ap

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

Ap applies a function to an argument under a type constructor.

func ApS added in v1.0.107

func ApS[GS1 ~func(R) S1, GS2 ~func(R) S2, GT ~func(R) T, R, S1, S2, T any](
	setter func(T) 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 Ask

func Ask[GR ~func(R) R, R any]() GR

Ask reads the current context

func Asks

func Asks[GA ~func(R) A, R, A any](f GA) GA

Asks projects a value from the global context in a Reader

func AsksReader

func AsksReader[GA ~func(R) A, R, A any](f func(R) GA) GA

func Bind added in v1.0.107

func Bind[GS1 ~func(R) S1, GS2 ~func(R) S2, GT ~func(R) T, R, S1, S2, T any](
	setter func(T) 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(R) S1, GT ~func(R) T, R, S1, T any](
	setter func(T) S1,
) func(GT) GS1

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

func Chain

func Chain[GA ~func(R) A, GB ~func(R) B, R, 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 Compose

func Compose[AB ~func(A) B, BC ~func(B) C, AC ~func(A) C, A, B, C any](ab AB) func(BC) AC

func Curry0

func Curry0[GA ~func(R) A, R, A any](f func(R) A) GA

func Curry1

func Curry1[GA ~func(R) A, R, T1, A any](f func(R, T1) A) func(T1) GA

func Curry2

func Curry2[GA ~func(R) A, R, T1, T2, A any](f func(R, T1, T2) A) func(T1) func(T2) GA

func Curry3

func Curry3[GA ~func(R) A, R, T1, T2, T3, A any](f func(R, T1, T2, T3) A) func(T1) func(T2) func(T3) GA

func Curry4

func Curry4[GA ~func(R) A, R, T1, T2, T3, T4, A any](f func(R, T1, T2, T3, T4) A) func(T1) func(T2) func(T3) func(T4) GA

func Do added in v1.0.107

func Do[GS ~func(R) S, R, S any](
	empty S,
) GS

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

func First

func First[GAB ~func(A) B, GABC ~func(T.Tuple2[A, C]) T.Tuple2[B, C], A, B, C any](pab GAB) GABC

func Flap added in v1.0.47

func Flap[GAB ~func(R) func(A) B, GB ~func(R) B, R, A, B any](a A) func(GAB) GB

func Flatten

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

func From0

func From0[GRA ~func(C) R, F ~func(C) R, C, R any](f F) func() GRA

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

func From1

func From1[GRA ~func(C) R, F ~func(C, T0) R, T0, C, R any](f F) func(T0) GRA

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

func From2

func From2[GRA ~func(C) R, F ~func(C, T0, T1) R, T0, T1, C, R any](f F) func(T0, T1) GRA

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

func From3

func From3[GRA ~func(C) R, F ~func(C, T0, T1, T2) R, T0, T1, T2, C, R any](f F) func(T0, T1, T2) GRA

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

func From4

func From4[GRA ~func(C) R, F ~func(C, T0, T1, T2, T3) 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 [R] into a function with 4 parameters returning a [GRA] The first parameter is considered to be the context [C].

func From5

func From5[GRA ~func(C) R, F ~func(C, T0, T1, T2, T3, T4) 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 [R] into a function with 5 parameters returning a [GRA] The first parameter is considered to be the context [C].

func From6

func From6[GRA ~func(C) R, F ~func(C, T0, T1, T2, T3, T4, T5) 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 [R] into a function with 6 parameters returning a [GRA] The first parameter is considered to be the context [C].

func From7

func From7[GRA ~func(C) R, F ~func(C, T0, T1, T2, T3, T4, T5, T6) 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 [R] into a function with 7 parameters returning a [GRA] The first parameter is considered to be the context [C].

func From8

func From8[GRA ~func(C) R, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7) 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 [R] into a function with 8 parameters returning a [GRA] The first parameter is considered to be the context [C].

func From9

func From9[GRA ~func(C) R, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8) 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 [R] into a function with 9 parameters returning a [GRA] The first parameter is considered to be the context [C].

func From10

func From10[GRA ~func(C) R, F ~func(C, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) 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 [R] into a function with 10 parameters returning a [GRA] The first parameter is considered to be the context [C].

func Let added in v1.0.107

func Let[GS1 ~func(R) S1, GS2 ~func(R) S2, R, S1, S2, T any](
	key func(T) func(S1) S2,
	f func(S1) T,
) 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(R) S1, GS2 ~func(R) S2, R, 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 Local

func Local[GA1 ~func(R1) A, GA2 ~func(R2) A, R2, R1, A any](f func(R2) R1) func(GA1) GA2

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

func MakeReader

func MakeReader[GA ~func(R) A, R, A any](r GA) GA

MakeReader creates a reader, i.e. a method that accepts a context and that returns a value

func Map

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

Map can be used to turn functions `func(A)B` into functions `(fa F[A])F[B]` whose argument and return types use the type constructor `F` to represent some computational context.

func MonadAp

func MonadAp[GA ~func(R) A, GB ~func(R) B, GAB ~func(R) func(A) B, R, A, B any](fab GAB, fa GA) GB

func MonadChain

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

func MonadFlap added in v1.0.47

func MonadFlap[GAB ~func(R) func(A) B, GB ~func(R) B, R, A, B any](fab GAB, a A) GB

func MonadMap

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

func MonadTraverseArray

func MonadTraverseArray[GB ~func(R) B, GBS ~func(R) BBS, AAS ~[]A, BBS ~[]B, R, A, B any](tas AAS, f func(A) GB) GBS

TraverseArray transforms an array

func Of

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

func Promap

func Promap[GA ~func(E) A, GB ~func(D) B, E, A, D, B any](f func(D) E, g func(A) B) func(GA) GB

func Read

func Read[GA ~func(E) A, E, A any](e E) func(GA) A

Read applies a context to a reader to obtain its value

func Second

func Second[GBC ~func(B) C, GABC ~func(T.Tuple2[A, B]) T.Tuple2[A, C], A, B, C any](pbc GBC) GABC

func SequenceArray

func SequenceArray[GA ~func(R) A, GAS ~func(R) AAS, AAS ~[]A, GAAS ~[]GA, R, A any](ma GAAS) GAS

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

func SequenceT1

func SequenceT1[GA ~func(R) A, GTA ~func(R) T.Tuple1[A], R, A any](a GA) GTA

func SequenceT2

func SequenceT2[GA ~func(R) A, GB ~func(R) B, GTAB ~func(R) T.Tuple2[A, B], R, A, B any](a GA, b GB) GTAB

func SequenceT3

func SequenceT3[GA ~func(R) A, GB ~func(R) B, GC ~func(R) C, GTABC ~func(R) T.Tuple3[A, B, C], R, A, B, C any](a GA, b GB, c GC) GTABC

func SequenceT4

func SequenceT4[GA ~func(R) A, GB ~func(R) B, GC ~func(R) C, GD ~func(R) D, GTABCD ~func(R) T.Tuple4[A, B, C, D], R, A, B, C, D any](a GA, b GB, c GC, d GD) GTABCD

func TraverseArray

func TraverseArray[GB ~func(R) B, GBS ~func(R) BBS, AAS ~[]A, BBS ~[]B, R, A, B any](f func(A) GB) func(AAS) GBS

TraverseArray transforms an array

func TraverseArrayWithIndex added in v1.0.29

func TraverseArrayWithIndex[GB ~func(R) B, GBS ~func(R) BBS, AAS ~[]A, BBS ~[]B, R, A, B any](f func(int, A) GB) func(AAS) GBS

TraverseArrayWithIndex transforms an array

func Uncurry0

func Uncurry0[GA ~func(R) A, R, A any](f GA) func(R) A

func Uncurry1

func Uncurry1[GA ~func(R) A, R, T1, A any](f func(T1) GA) func(R, T1) A

func Uncurry2

func Uncurry2[GA ~func(R) A, R, T1, T2, A any](f func(T1) func(T2) GA) func(R, T1, T2) A

func Uncurry3

func Uncurry3[GA ~func(R) A, R, T1, T2, T3, A any](f func(T1) func(T2) func(T3) GA) func(R, T1, T2, T3) A

func Uncurry4

func Uncurry4[GA ~func(R) A, R, T1, T2, T3, T4, A any](f func(T1) func(T2) func(T3) func(T4) GA) func(R, T1, T2, T3, T4) A

Types

This section is empty.

Jump to

Keyboard shortcuts

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