Documentation
¶
Index ¶
- func Bind[B1, E, F any](f func(B1, E) F, b1 B1) func(E) F
- func BindFunc[B1, E, F any](f func(B1, E) F, supplier func() B1) func(E) F
- func CastIn[NewIn, OldIn, Out any](f func(OldIn) Out) func(NewIn) Out
- func CastIn0[NewIn, OldIn any](f func(OldIn)) func(NewIn)
- func CastIn2[NewIn, OldIn, Out1, Out2 any](f func(OldIn) (Out1, Out2)) func(NewIn) (Out1, Out2)
- func CastInOut[NewIn, NewOut, OldIn, OldOut any](f func(OldIn) OldOut) func(NewIn) NewOut
- func CastOut[NewOut, OldOut, In any](f func(In) OldOut) func(In) NewOut
- func CastOut0[NewOut, OldOut any](f func() OldOut) func() NewOut
- func CastOut2[NewOut, OldOut, In1, In2 any](f func(In1, In2) OldOut) func(In1, In2) NewOut
- func Chain[V any](fs ...func(V) V) func(V) V
- func Chain2[K, V any](fs ...func(K, V) (K, V)) func(K, V) (K, V)
- func ChainSeq[V any](fs iter.Seq[func(V) V]) func(V) V
- func ChainSeq2[K, V any](fs iter.Seq[func(K, V) (K, V)]) func(K, V) (K, V)
- func Compose[In, Mid, Out any](f1 func(In) Mid, f2 func(Mid) Out) func(In) Out
- func Compose2[In1, In2, Mid1, Mid2, Out1, Out2 any](f1 func(In1, In2) (Mid1, Mid2), f2 func(Mid1, Mid2) (Out1, Out2)) func(In1, In2) (Out1, Out2)
- func ComposeErr[In, Mid, Out any](f1 func(In) (Mid, error), f2 func(Mid) (Out, error)) func(In) (Out, error)
- func Const[F, E any](e E) func(F) E
- func DropKey[E, K, V any](f func(E) (K, V)) func(E) V
- func DropValue[E, K, V any](f func(E) (K, V)) func(E) K
- func Flip[In1, In2, Out any](f func(In1, In2) Out) func(In2, In1) Out
- func Identity[V any](v V) V
- func LiftKeyConst[In, Out1, Out2 any](f func(In) Out2, out1 Out1) func(In) (Out1, Out2)
- func LiftKeyZero[Out1, In, Out2 any](f func(In) Out2) func(In) (Out1, Out2)
- func LiftSuccess[In, Out any](f func(In) Out) func(In) (Out, error)
- func LiftValueConst[In, Out1, Out2 any](f func(In) Out1, out2 Out2) func(In) (Out1, Out2)
- func LiftValueZero[Out2, In, Out1 any](f func(In) Out1) func(In) (Out1, Out2)
- func Merge[In, Out1, Out2 any](f1 func(In) Out1, f2 func(In) Out2) func(In) (Out1, Out2)
- func Narrow[In, Out any](f func(any) Out) func(In) Out
- func Narrow0[In any](f func(any)) func(In)
- func Narrow2[In, Out1, Out2 any](f func(any) (Out1, Out2)) func(In) (Out1, Out2)
- func Split[In, Out1, Out2 any](f func(In) (Out1, Out2)) (func(In) Out1, func(In) Out2)
- func Uncurried[In, Mid, Out any](f func(In) func(Mid) Out) func(In, Mid) Out
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
func Bind[B1, E, F any](f func(B1, E) F, b1 B1) func(E) F
Bind partially applies the first argument of a two-argument function.
func BindFunc ¶
func BindFunc[B1, E, F any](f func(B1, E) F, supplier func() B1) func(E) F
BindFunc partially applies the first argument of a two-argument function using a supplier function.
func CastIn ¶
func CastIn[NewIn, OldIn, Out any](f func(OldIn) Out) func(NewIn) Out
CastIn wraps a function by casting its input parameter from NewIn to OldIn via type assertion.
func CastIn0 ¶
func CastIn0[NewIn, OldIn any](f func(OldIn)) func(NewIn)
CastIn0 wraps a function by casting its input parameter from NewIn to OldIn via type assertion.
func CastIn2 ¶
func CastIn2[NewIn, OldIn, Out1, Out2 any](f func(OldIn) (Out1, Out2)) func(NewIn) (Out1, Out2)
CastIn2 wraps a function by casting its input parameter from NewIn to OldIn via type assertion, for functions that return two values.
func CastInOut ¶
func CastInOut[NewIn, NewOut, OldIn, OldOut any](f func(OldIn) OldOut) func(NewIn) NewOut
CastInOut wraps a function by casting both its input and output via type assertions.
func CastOut ¶
func CastOut[NewOut, OldOut, In any](f func(In) OldOut) func(In) NewOut
CastOut wraps a function by casting its output from OldOut to NewOut via type assertion.
func CastOut0 ¶
func CastOut0[NewOut, OldOut any](f func() OldOut) func() NewOut
CastOut0 wraps a zero-argument function by casting its output from OldOut to NewOut via type assertion.
func CastOut2 ¶
func CastOut2[NewOut, OldOut, In1, In2 any](f func(In1, In2) OldOut) func(In1, In2) NewOut
CastOut2 wraps a two-argument function by casting its output from OldOut to NewOut via type assertion.
func Chain ¶
func Chain[V any](fs ...func(V) V) func(V) V
Chain returns a function that applies all given functions in sequence, passing the output of each as input to the next.
func Chain2 ¶
func Chain2[K, V any](fs ...func(K, V) (K, V)) func(K, V) (K, V)
Chain2 returns a function that applies all given two-argument functions in sequence.
func ChainSeq ¶
ChainSeq returns a function that applies all functions from the iterator in sequence.
func ChainSeq2 ¶
ChainSeq2 returns a function that applies all two-argument functions from the iterator in sequence.
func Compose ¶
func Compose[In, Mid, Out any](f1 func(In) Mid, f2 func(Mid) Out) func(In) Out
Compose composes two functions, applying f1 first and then f2 to the result.
func Compose2 ¶
func Compose2[In1, In2, Mid1, Mid2, Out1, Out2 any](f1 func(In1, In2) (Mid1, Mid2), f2 func(Mid1, Mid2) (Out1, Out2)) func(In1, In2) (Out1, Out2)
Compose2 composes two functions that take and return pairs, applying f1 first and then f2.
func ComposeErr ¶
func ComposeErr[In, Mid, Out any](f1 func(In) (Mid, error), f2 func(Mid) (Out, error)) func(In) (Out, error)
ComposeErr composes two functions that can return errors, short-circuiting on the first error.
func Const ¶
func Const[F, E any](e E) func(F) E
Const returns a function that always returns the given value, ignoring its argument.
func DropKey ¶
func DropKey[E, K, V any](f func(E) (K, V)) func(E) V
DropKey wraps a function that returns (K, V) to return only V, discarding the first return value.
func DropValue ¶
func DropValue[E, K, V any](f func(E) (K, V)) func(E) K
DropValue wraps a function that returns (K, V) to return only K, discarding the second return value.
func Flip ¶
func Flip[In1, In2, Out any](f func(In1, In2) Out) func(In2, In1) Out
Flip swaps the arguments of a two-argument function.
func Identity ¶
func Identity[V any](v V) V
Identity returns the value unchanged. It is the identity function.
func LiftKeyConst ¶
func LiftKeyConst[In, Out1, Out2 any](f func(In) Out2, out1 Out1) func(In) (Out1, Out2)
LiftKeyConst lifts a function to return a pair, where the first value is a constant.
func LiftKeyZero ¶
func LiftKeyZero[Out1, In, Out2 any](f func(In) Out2) func(In) (Out1, Out2)
LiftKeyZero lifts a function to return a pair, where the first value is the zero value.
func LiftSuccess ¶
LiftSuccess lifts a function to return a (value, error) pair with a nil error.
func LiftValueConst ¶
func LiftValueConst[In, Out1, Out2 any](f func(In) Out1, out2 Out2) func(In) (Out1, Out2)
LiftValueConst lifts a function to return a pair, where the second value is a constant.
func LiftValueZero ¶
func LiftValueZero[Out2, In, Out1 any](f func(In) Out1) func(In) (Out1, Out2)
LiftValueZero lifts a function to return a pair, where the second value is the zero value.
func Merge ¶
func Merge[In, Out1, Out2 any](f1 func(In) Out1, f2 func(In) Out2) func(In) (Out1, Out2)
Merge combines two functions with the same input into a single function that returns both outputs.
func Narrow ¶
Narrow narrows a function that takes any to a function that takes a specific type, preserving the output.
func Narrow2 ¶
Narrow2 narrows a function that takes any to a function that takes a specific type, preserving two output values.
Types ¶
This section is empty.