either

package
v0.30.96 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fold

func Fold[L, R, A any](e Monad[L, R], l func(L) A, r func(R) A) A

Fold (fold/either)

func Match

func Match[L, R any](e Monad[L, R], l func(L), r func(R))

Match (fold/either)

Types

type Monad added in v0.26.0

type Monad[L, R any] any

Monad represents one of two values (left or right).

func Apply

func Apply[L, R, R2 any](e Monad[L, func(R) R2], f Monad[L, R]) Monad[L, R2]

Apply (apply/<*>/ap)

func FlatMap

func FlatMap[L, R, R2 any](e Monad[L, R], f func(R) Monad[L, R2]) Monad[L, R2]

FlatMap (flatMap/bind/chain/liftM)

func Left

func Left[L any](val L) Monad[L, any]

Left returns a new Monad with a left value.

func Map

func Map[L, R, R2 any](e Monad[L, R], f func(R) R2) Monad[L, R2]

Map (map/fmap)

func MapLeft

func MapLeft[L, L2, R any](e Monad[L, R], f func(L) L2) Monad[L2, R]

MapLeft (mapLeft)

func Right[R any](val R) Monad[any, R]

Right returns a new Monad with a right value.

func Seq

func Seq[L, R, R2 any](_ Monad[L, R], e Monad[L, R2]) Monad[L, R2]

Seq (seq)

Jump to

Keyboard shortcuts

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