package
Version:
v0.3.6
Opens a new window with list of versions in this module.
Published: Oct 16, 2022
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
-
func Fold[A any, B any, C any](eab Either[A, B], left func(A) C, right func(B) C) C
-
func GetLeft[A any, B any](eab Either[A, B]) option.Option[A]
-
func GetRight[A any, B any](eab Either[A, B]) option.Option[B]
-
func IsLeft[A any, B any](eab Either[A, B]) bool
-
func IsRight[A any, B any](eab Either[A, B]) bool
-
type Either
func Fold[A any, B any, C any](eab Either[A, B], left func(A) C, right func(B) C) C
Fold pattern matches Either with two given pattern match handlers
GetLeft returns left if it's defined.
GetRight returns left if it's defined.
IsLeft checks whether the provided Either is left or not.
IsRight checks whether the provided Either is right or not.
type Either[A any, B any] struct {
IsLeft bool
Left A
Right B
}
Either is a simple data structure that can have either left value or right value.
Left constructs Either that is left.
Right constructs Either that is right.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.