package bos

  1. Overview
  2. Docs
include module type of struct include Rresult.R end
type (!'a, !'b) t = ('a, 'b) Rresult.result
val ok : 'a -> ('a, 'b) Rresult.result
val error : 'b -> ('a, 'b) Rresult.result
val reword_error : ('b -> 'c) -> ('a, 'b) Rresult.result -> ('a, 'c) Rresult.result
val get_ok : ('a, 'b) Rresult.result -> 'a
val get_error : ('a, 'b) Rresult.result -> 'b
val return : 'a -> ('a, 'b) Rresult.result
val fail : 'b -> ('a, 'b) Rresult.result
val bind : ('a, 'b) Rresult.result -> ('a -> ('c, 'b) Rresult.result) -> ('c, 'b) Rresult.result
val map : ('a -> 'c) -> ('a, 'b) Rresult.result -> ('c, 'b) Rresult.result
val join : (('a, 'b) Rresult.result, 'b) Rresult.result -> ('a, 'b) Rresult.result
val (>>=) : ('a, 'b) Rresult.result -> ('a -> ('c, 'b) Rresult.result) -> ('c, 'b) Rresult.result
val (>>|) : ('a, 'b) Rresult.result -> ('a -> 'c) -> ('c, 'b) Rresult.result
module Infix = Rresult.R.Infix
type msg = [
  1. | `Msg of string
]
val msg : string -> [> msg ]
val msgf : ('a, Stdlib.Format.formatter, unit, [> msg ]) Stdlib.format4 -> 'a
val pp_msg : Stdlib.Format.formatter -> msg -> unit
val error_msg : string -> ('a, [> msg ]) Rresult.result
val error_msgf : ('a, Stdlib.Format.formatter, unit, ('b, [> msg ]) Rresult.result) Stdlib.format4 -> 'a
val reword_error_msg : ?replace:bool -> (string -> msg) -> ('a, msg) Rresult.result -> ('a, [> msg ]) Rresult.result
val error_to_msg : pp_error:(Stdlib.Format.formatter -> 'b -> unit) -> ('a, 'b) Rresult.result -> ('a, [> msg ]) Rresult.result
val error_msg_to_invalid_arg : ('a, msg) Rresult.result -> 'a
val open_error_msg : ('a, msg) Rresult.result -> ('a, [> msg ]) Rresult.result
val failwith_error_msg : ('a, msg) Rresult.result -> 'a
type exn_trap = [
  1. | `Exn_trap of exn * Stdlib.Printexc.raw_backtrace
]
val pp_exn_trap : Stdlib.Format.formatter -> exn_trap -> unit
val trap_exn : ('a -> 'b) -> 'a -> ('b, [> exn_trap ]) Rresult.result
val error_exn_trap_to_msg : ('a, exn_trap) Rresult.result -> ('a, [> msg ]) Rresult.result
val open_error_exn_trap : ('a, exn_trap) Rresult.result -> ('a, [> exn_trap ]) Rresult.result
val pp : ok:(Stdlib.Format.formatter -> 'a -> unit) -> error:(Stdlib.Format.formatter -> 'b -> unit) -> Stdlib.Format.formatter -> ('a, 'b) Rresult.result -> unit
val dump : ok:(Stdlib.Format.formatter -> 'a -> unit) -> error:(Stdlib.Format.formatter -> 'b -> unit) -> Stdlib.Format.formatter -> ('a, 'b) Rresult.result -> unit
val is_ok : ('a, 'b) Rresult.result -> bool
val is_error : ('a, 'b) Rresult.result -> bool
val equal : ok:('a -> 'a -> bool) -> error:('b -> 'b -> bool) -> ('a, 'b) Rresult.result -> ('a, 'b) Rresult.result -> bool
val compare : ok:('a -> 'a -> int) -> error:('b -> 'b -> int) -> ('a, 'b) Rresult.result -> ('a, 'b) Rresult.result -> int
val to_option : ('a, 'b) Rresult.result -> 'a option
val of_option : none:(unit -> ('a, 'b) Rresult.result) -> 'a option -> ('a, 'b) Rresult.result
val to_presult : ('a, 'b) Rresult.result -> [> `Error of 'b | `Ok of 'a ]
val of_presult : [< `Error of 'b | `Ok of 'a ] -> ('a, 'b) Rresult.result
val ignore_error : use:('b -> 'a) -> ('a, 'b) Rresult.result -> 'a
val kignore_error : use:('b -> ('a, 'c) Rresult.result) -> ('a, 'b) Rresult.result -> ('a, 'c) Rresult.result
OCaml

Innovation. Community. Security.