Module CCResult.Infix

val (<$>) : ('a -> 'b) -> ('a, 'err) t -> ('b, 'err) t

Infix version of map.

  • since 3.0
val (>|=) : ('a, 'err) t -> ('a -> 'b) -> ('b, 'err) t

Infix version of map with reversed arguments.

val (>>=) : ('a, 'err) t -> ('a -> ('b, 'err) t) -> ('b, 'err) t

Monadic composition. e >>= f proceeds as f x if e is Ok x or returns e if e is an Error.

val (<*>) : ('a -> 'b, 'err) t -> ('a, 'err) t -> ('b, 'err) t

a <*> b evaluates a and b, and, in case of success, returns Ok (a b). Otherwise, it fails, and the error of a is chosen over the error of b if both fail.

val (|?>) : 'a -> ('a -> ('a, _) t) -> 'a

Alias for apply_or

  • since 3.13.1
val let+ : ('a, 'e) t -> ('a -> 'b) -> ('b, 'e) t
  • since 2.8
val and+ : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t
  • since 2.8
val let* : ('a, 'e) t -> ('a -> ('b, 'e) t) -> ('b, 'e) t
  • since 2.8
val and* : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t
  • since 2.8
val (>=>) : ('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t

Monadic k_compose.

  • since 3.13.1
val (<=<) : ('b -> ('c, 'err) t) -> ('a -> ('b, 'err) t) -> 'a -> ('c, 'err) t

Reverse monadic k_compose.

  • since 3.13.1