Module B0_std.Result

Result values

include module type of Stdlib.Result
type (!'a, !'e) t = ('a, 'e) Stdlib.result =
  1. | Ok of 'a
  2. | Error of 'e
val ok : 'a -> ('a, 'e) Stdlib.result
val error : 'e -> ('a, 'e) Stdlib.result
val value : ('a, 'e) Stdlib.result -> default:'a -> 'a
val get_ok : ('a, 'e) Stdlib.result -> 'a
val get_error : ('a, 'e) Stdlib.result -> 'e
val bind : ('a, 'e) Stdlib.result -> ('a -> ('b, 'e) Stdlib.result) -> ('b, 'e) Stdlib.result
val join : (('a, 'e) Stdlib.result, 'e) Stdlib.result -> ('a, 'e) Stdlib.result
val map : ('a -> 'b) -> ('a, 'e) Stdlib.result -> ('b, 'e) Stdlib.result
val map_error : ('e -> 'f) -> ('a, 'e) Stdlib.result -> ('a, 'f) Stdlib.result
val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) Stdlib.result -> 'c
val iter : ('a -> unit) -> ('a, 'e) Stdlib.result -> unit
val iter_error : ('e -> unit) -> ('a, 'e) Stdlib.result -> unit
val is_ok : ('a, 'e) Stdlib.result -> bool
val is_error : ('a, 'e) Stdlib.result -> bool
val equal : ok:('a -> 'a -> bool) -> error:('e -> 'e -> bool) -> ('a, 'e) Stdlib.result -> ('a, 'e) Stdlib.result -> bool
val compare : ok:('a -> 'a -> int) -> error:('e -> 'e -> int) -> ('a, 'e) Stdlib.result -> ('a, 'e) Stdlib.result -> int
val to_option : ('a, 'e) Stdlib.result -> 'a option
val to_list : ('a, 'e) Stdlib.result -> 'a list
val to_seq : ('a, 'e) Stdlib.result -> 'a Stdlib.Seq.t
val get_ok' : ('a, string) Stdlib.result -> 'a

get_ok' r is like get_ok but the message of Invalid_argument is the error meesage.

val retract : ('a, 'a) Stdlib.result -> 'a

retract r is v if r is Ok v or Error v.

val error_to_failure : ('a, string) Stdlib.result -> 'a

error_to_failure r is failwith e if r is Error e and v if r is Ok v.

module Syntax : sig ... end

let operators.