package stdcompat

  1. Overview
  2. Docs
type ('a, 'e) t = ('a, 'e) Stdlib.result =
  1. | Ok of 'a
  2. | Error of 'e
  • since 4.08.0:

type ('a, 'e) t = ('a, 'e) result = | Ok of 'a | Error of 'e

val ok : 'a -> ('a, 'e) Stdlib.result
  • since 4.08.0: val ok : 'a -> ('a, 'e) result
val error : 'e -> ('a, 'e) Stdlib.result
  • since 4.08.0: val error : 'e -> ('a, 'e) result
val value : ('a, 'e) Stdlib.result -> default:'a -> 'a
  • since 4.08.0: val value : ('a, 'e) result -> default:'a -> 'a
val get_ok : ('a, 'e) Stdlib.result -> 'a
  • since 4.08.0: val get_ok : ('a, 'e) result -> 'a
val get_error : ('a, 'e) Stdlib.result -> 'e
  • since 4.08.0: val get_error : ('a, 'e) result -> 'e
val bind : ('a, 'e) Stdlib.result -> ('a -> ('b, 'e) Stdlib.result) -> ('b, 'e) Stdlib.result
  • since 4.08.0:

val bind : ('a, 'e) result -> ('a -> ('b, 'e) result) -> ('b, 'e) result

val join : (('a, 'e) Stdlib.result, 'e) Stdlib.result -> ('a, 'e) Stdlib.result
  • since 4.08.0: val join : (('a, 'e) result, 'e) result -> ('a, 'e) result
val map : ('a -> 'b) -> ('a, 'e) Stdlib.result -> ('b, 'e) Stdlib.result
  • since 4.08.0: val map : ('a -> 'b) -> ('a, 'e) result -> ('b, 'e) result
val map_error : ('e -> 'f) -> ('a, 'e) Stdlib.result -> ('a, 'f) Stdlib.result
  • since 4.08.0:

val map_error : ('e -> 'f) -> ('a, 'e) result -> ('a, 'f) result

val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) Stdlib.result -> 'c
  • since 4.08.0:

val fold : ok:('a -> 'c) -> error:('e -> 'c) -> ('a, 'e) result -> 'c

val iter : ('a -> unit) -> ('a, 'e) Stdlib.result -> unit
  • since 4.08.0: val iter : ('a -> unit) -> ('a, 'e) result -> unit
val iter_error : ('e -> unit) -> ('a, 'e) Stdlib.result -> unit
  • since 4.08.0: val iter_error : ('e -> unit) -> ('a, 'e) result -> unit
val is_ok : ('a, 'e) Stdlib.result -> bool
  • since 4.08.0: val is_ok : ('a, 'e) result -> bool
val is_error : ('a, 'e) Stdlib.result -> bool
  • since 4.08.0: val is_error : ('a, 'e) result -> bool
val equal : ok:('a -> 'a -> bool) -> error:('e -> 'e -> bool) -> ('a, 'e) Stdlib.result -> ('a, 'e) Stdlib.result -> bool
  • since 4.08.0:

val equal : ok:('a -> 'a -> bool) -> error:('e -> 'e -> bool) -> ('a, 'e) result -> ('a, 'e) result -> bool

val compare : ok:('a -> 'a -> int) -> error:('e -> 'e -> int) -> ('a, 'e) Stdlib.result -> ('a, 'e) Stdlib.result -> int
  • since 4.08.0:

val compare : ok:('a -> 'a -> int) -> error:('e -> 'e -> int) -> ('a, 'e) result -> ('a, 'e) result -> int

val to_option : ('a, 'e) Stdlib.result -> 'a option
  • since 4.08.0: val to_option : ('a, 'e) result -> 'a option
val to_list : ('a, 'e) Stdlib.result -> 'a list
  • since 4.08.0: val to_list : ('a, 'e) result -> 'a list
val to_seq : ('a, 'e) Stdlib.result -> 'a Stdlib.Seq.t
  • since 4.08.0: val to_seq : ('a, 'e) result -> 'a Seq.t
OCaml

Innovation. Community. Security.