ior

Types

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

Constructors

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

Functions

pub fn as_options(ior: Ior(a, b)) -> #(Option(a), Option(b))
pub fn bimap(
  ior: Ior(a, b),
  left_map: fn(a) -> c,
  right_map: fn(b) -> d,
) -> Ior(c, d)
pub fn combine(
  ior: Ior(a, b),
  ior2: Ior(a, b),
  combine_left: fn(a, a) -> a,
  combine_right: fn(b, b) -> b,
) -> Ior(a, b)
pub fn exists(ior: Ior(a, b), predicate: fn(b) -> Bool) -> Bool
pub fn flat_map(
  ior: Ior(a, b),
  combine: fn(a, a) -> a,
  f: fn(b) -> Ior(a, c),
) -> Ior(a, c)
pub fn fold(
  ior: Ior(a, b),
  case_left: fn(a) -> c,
  case_right: fn(b) -> c,
  case_both: fn(a, b) -> c,
) -> c
pub fn for_all(ior: Ior(a, b), predicate: fn(b) -> Bool) -> Bool
pub fn get_left(ior: Ior(a, b)) -> Option(a)
pub fn get_or_else(ior: Ior(a, b), default: b) -> b
pub fn get_right(ior: Ior(a, b)) -> Option(b)
pub fn is_both(ior: Ior(a, b)) -> Bool
pub fn is_left(ior: Ior(a, b)) -> Bool
pub fn is_right(ior: Ior(a, b)) -> Bool
pub fn left_map(ior: Ior(a, b), f: fn(a) -> c) -> Ior(c, b)
pub fn map(ior: Ior(a, b), f: fn(b) -> c) -> Ior(a, c)
pub fn only_both(ior: Ior(a, b)) -> Option(#(a, b))
pub fn only_left(ior: Ior(a, b)) -> Option(a)
pub fn only_right(ior: Ior(a, b)) -> Option(b)
pub fn put_left(ior: Ior(a, b), left: c) -> Ior(c, b)
pub fn put_right(ior: Ior(a, b), right: c) -> Ior(a, c)
pub fn swap(ior: Ior(a, b)) -> Ior(b, a)
Search Document