gleither

Types

pub type Either(left, right) {
  Left(val: left)
  Right(val: right)
}

Constructors

  • Left(val: left)
  • Right(val: right)

Functions

pub fn flat_map(
  either: Either(a, b),
  func: fn(a) -> Either(a, b),
) -> Either(a, b)
pub fn flat_map_right(
  either: Either(a, b),
  func: fn(b) -> Either(a, b),
) -> Either(a, b)
pub fn flatten(either: Either(Either(a, b), b)) -> Either(a, b)
pub fn flatten_right(
  either: Either(a, Either(a, b)),
) -> Either(a, b)
pub fn get(either: Either(a, b)) -> Option(a)
pub fn get_right(either: Either(a, b)) -> Option(b)
pub fn is_left(either: Either(a, b)) -> Bool
pub fn is_right(either: Either(a, b)) -> Bool
pub fn map(
  either: Either(a, b),
  func: fn(a) -> c,
) -> Either(c, b)
pub fn map_right(
  either: Either(a, b),
  func: fn(b) -> c,
) -> Either(a, c)
pub fn swap(either: Either(a, b)) -> Either(b, a)
Search Document