package clarity

  1. Overview
  2. Docs
type ('l, 'r) t =
  1. | Left of 'l
  2. | Right of 'r
  3. | Both of 'l * 'r

Values of two non-exclusive variants

val _Left : 'a -> ('a, 'b) t
val _Right : 'a -> ('b, 'a) t
val _Both : 'a -> 'b -> ('a, 'b) t
module Make (S : Semigroup.S) : Monad.S with type 'a t = (S.t, 'a) t

Monad instance requires Semigroup to combine Left values

val bimap : ('a -> 'b) -> ('c -> 'd) -> ('a, 'c) t -> ('b, 'd) t
val fold : ('a -> 'b) -> ('c -> 'b) -> ('a -> 'c -> 'b) -> ('a, 'c) t -> 'b
val swap : ('a, 'b) t -> ('b, 'a) t
val maybe_left : ('a, 'b) t -> 'a option
val maybe_right : ('a, 'b) t -> 'b option
val maybe_both : ('a, 'b) t -> ('a * 'b) option
OCaml

Innovation. Community. Security.