either

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Either

type Either[E any, A any] struct {
	Success *A
	Error   *E
}

func App2

func App2[E, A, B, C any](f func(A, B) C, m1 *Either[E, A], m2 *Either[E, B]) *Either[E, C]

func Bind

func Bind[E, A, B any](m *Either[E, A], f func(A) *Either[E, B]) *Either[E, B]

func Error

func Error[E any, A any](error E) *Either[E, A]

func Map

func Map[E, A, B any](m *Either[E, A], f func(a A) B) *Either[E, B]

func MapError

func MapError[E1, E2, A any](m *Either[E1, A], f func(E1) E2) *Either[E2, A]

func Success

func Success[E any, A any](value A) *Either[E, A]

func (*Either[E, A]) IsValid

func (e *Either[E, A]) IsValid() bool

IsValid is a debugging check

func (*Either[E, A]) Plus

func (e *Either[E, A]) Plus(other *Either[E, A]) *Either[E, A]

Jump to

Keyboard shortcuts

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