either4

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package either4 provides cross type transformations for `mo.Either`.

The functions provided by this package are not methods of `mo.Either` due to the lack of method type parameters on methods. This is part of the design decision of the Go's generics as explained here: https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#No-parameterized-methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapArg1

func MapArg1[In1 any, In2 any, In3 any, In4 any, Out1 any](f func(In1) Out1) func(either mo.Either4[In1, In2, In3, In4]) mo.Either4[Out1, In2, In3, In4]

MapArg1 executes the given function, if Either3 use the first argument, and returns result.

func MapArg2

func MapArg2[In1 any, In2 any, In3 any, In4 any, Out2 any](f func(In2) Out2) func(either mo.Either4[In1, In2, In3, In4]) mo.Either4[In1, Out2, In3, In4]

MapArg2 executes the given function, if Either3 use the second argument, and returns result.

func MapArg3

func MapArg3[In1 any, In2 any, In3 any, In4 any, Out3 any](f func(In3) Out3) func(either mo.Either4[In1, In2, In3, In4]) mo.Either4[In1, In2, Out3, In4]

MapArg3 executes the given function, if Either3 use the third argument, and returns result.

func Match

func Match[In1 any, In2 any, In3 any, In4 any, Out1 any, Out2 any, Out3 any, Out4 any](onArg1 func(In1) Out1, onArg2 func(In2) Out2, onArg3 func(In3) Out3, onArg4 func(In4) Out4) func(either mo.Either4[In1, In2, In3, In4]) mo.Either4[Out1, Out2, Out3, Out4]

Match returns the result of applying `onLeft` to the left value of the either or `onRight` to the right value of the either.

func Pipe1

func Pipe1[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
) mo.Either4[B1, B2, B3, B4]

func Pipe10

func Pipe10[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any, E1 any, E2 any, E3 any, E4 any, F1 any, F2 any, F3 any, F4 any, G1 any, G2 any, G3 any, G4 any, H1 any, H2 any, H3 any, H4 any, I1 any, I2 any, I3 any, I4 any, J1 any, J2 any, J3 any, J4 any, K1 any, K2 any, K3 any, K4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
	operator4 func(mo.Either4[D1, D2, D3, D4]) mo.Either4[E1, E2, E3, E4],
	operator5 func(mo.Either4[E1, E2, E3, E4]) mo.Either4[F1, F2, F3, F4],
	operator6 func(mo.Either4[F1, F2, F3, F4]) mo.Either4[G1, G2, G3, G4],
	operator7 func(mo.Either4[G1, G2, G3, G4]) mo.Either4[H1, H2, H3, H4],
	operator8 func(mo.Either4[H1, H2, H3, H4]) mo.Either4[I1, I2, I3, I4],
	operator9 func(mo.Either4[I1, I2, I3, I4]) mo.Either4[J1, J2, J3, J4],
	operator10 func(mo.Either4[J1, J2, J3, J4]) mo.Either4[K1, K2, K3, K4],
) mo.Either4[K1, K2, K3, K4]

func Pipe2

func Pipe2[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
) mo.Either4[C1, C2, C3, C4]

func Pipe3

func Pipe3[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
) mo.Either4[D1, D2, D3, D4]

func Pipe4

func Pipe4[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any, E1 any, E2 any, E3 any, E4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
	operator4 func(mo.Either4[D1, D2, D3, D4]) mo.Either4[E1, E2, E3, E4],
) mo.Either4[E1, E2, E3, E4]

func Pipe5

func Pipe5[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any, E1 any, E2 any, E3 any, E4 any, F1 any, F2 any, F3 any, F4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
	operator4 func(mo.Either4[D1, D2, D3, D4]) mo.Either4[E1, E2, E3, E4],
	operator5 func(mo.Either4[E1, E2, E3, E4]) mo.Either4[F1, F2, F3, F4],
) mo.Either4[F1, F2, F3, F4]

func Pipe6

func Pipe6[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any, E1 any, E2 any, E3 any, E4 any, F1 any, F2 any, F3 any, F4 any, G1 any, G2 any, G3 any, G4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
	operator4 func(mo.Either4[D1, D2, D3, D4]) mo.Either4[E1, E2, E3, E4],
	operator5 func(mo.Either4[E1, E2, E3, E4]) mo.Either4[F1, F2, F3, F4],
	operator6 func(mo.Either4[F1, F2, F3, F4]) mo.Either4[G1, G2, G3, G4],
) mo.Either4[G1, G2, G3, G4]

func Pipe7

func Pipe7[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any, E1 any, E2 any, E3 any, E4 any, F1 any, F2 any, F3 any, F4 any, G1 any, G2 any, G3 any, G4 any, H1 any, H2 any, H3 any, H4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
	operator4 func(mo.Either4[D1, D2, D3, D4]) mo.Either4[E1, E2, E3, E4],
	operator5 func(mo.Either4[E1, E2, E3, E4]) mo.Either4[F1, F2, F3, F4],
	operator6 func(mo.Either4[F1, F2, F3, F4]) mo.Either4[G1, G2, G3, G4],
	operator7 func(mo.Either4[G1, G2, G3, G4]) mo.Either4[H1, H2, H3, H4],
) mo.Either4[H1, H2, H3, H4]

func Pipe8

func Pipe8[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any, E1 any, E2 any, E3 any, E4 any, F1 any, F2 any, F3 any, F4 any, G1 any, G2 any, G3 any, G4 any, H1 any, H2 any, H3 any, H4 any, I1 any, I2 any, I3 any, I4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
	operator4 func(mo.Either4[D1, D2, D3, D4]) mo.Either4[E1, E2, E3, E4],
	operator5 func(mo.Either4[E1, E2, E3, E4]) mo.Either4[F1, F2, F3, F4],
	operator6 func(mo.Either4[F1, F2, F3, F4]) mo.Either4[G1, G2, G3, G4],
	operator7 func(mo.Either4[G1, G2, G3, G4]) mo.Either4[H1, H2, H3, H4],
	operator8 func(mo.Either4[H1, H2, H3, H4]) mo.Either4[I1, I2, I3, I4],
) mo.Either4[I1, I2, I3, I4]

func Pipe9

func Pipe9[A1 any, A2 any, A3 any, A4 any, B1 any, B2 any, B3 any, B4 any, C1 any, C2 any, C3 any, C4 any, D1 any, D2 any, D3 any, D4 any, E1 any, E2 any, E3 any, E4 any, F1 any, F2 any, F3 any, F4 any, G1 any, G2 any, G3 any, G4 any, H1 any, H2 any, H3 any, H4 any, I1 any, I2 any, I3 any, I4 any, J1 any, J2 any, J3 any, J4 any](
	source mo.Either4[A1, A2, A3, A4],
	operator1 func(mo.Either4[A1, A2, A3, A4]) mo.Either4[B1, B2, B3, B4],
	operator2 func(mo.Either4[B1, B2, B3, B4]) mo.Either4[C1, C2, C3, C4],
	operator3 func(mo.Either4[C1, C2, C3, C4]) mo.Either4[D1, D2, D3, D4],
	operator4 func(mo.Either4[D1, D2, D3, D4]) mo.Either4[E1, E2, E3, E4],
	operator5 func(mo.Either4[E1, E2, E3, E4]) mo.Either4[F1, F2, F3, F4],
	operator6 func(mo.Either4[F1, F2, F3, F4]) mo.Either4[G1, G2, G3, G4],
	operator7 func(mo.Either4[G1, G2, G3, G4]) mo.Either4[H1, H2, H3, H4],
	operator8 func(mo.Either4[H1, H2, H3, H4]) mo.Either4[I1, I2, I3, I4],
	operator9 func(mo.Either4[I1, I2, I3, I4]) mo.Either4[J1, J2, J3, J4],
) mo.Either4[J1, J2, J3, J4]

Types

This section is empty.