Module CCEither
Either Monad
Module that is compatible with Either form OCaml 4.12 but can be use with any ocaml version compatible with container
- since
- 3.2
type 'a iter= ('a -> unit) -> unittype 'a equal= 'a -> 'a -> booltype 'a ord= 'a -> 'a -> inttype 'a printer= Stdlib.Format.formatter -> 'a -> unit
Basics
include module type of CCShimsEither_
val left : 'a -> ('a, 'b) tleft lisLeft l
val right : 'b -> ('a, 'b) tright risRight r
val is_left : ('a, 'b) t -> boolis_left xchecks ifx = Left _
val is_right : ('a, 'b) t -> boolis_right xchecks ifx = Right _
val find_left : ('a, 'b) t -> 'a optionfind_left xreturnslifx = Left landNoneotherwise.
val find_right : ('a, 'b) t -> 'b optionfind_right xreturnsrifx = Left randNoneotherwise.
val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) tMap using
leftorright.
val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'cFold using
leftorright.
val iter : left:('a -> unit) -> right:('b -> unit) -> ('a, 'b) t -> unitIter using
leftorright.
val for_all : left:('a -> bool) -> right:('b -> bool) -> ('a, 'b) t -> boolCheck some property on
LeftorRightvariant.