package plebeia

  1. Overview
  2. Docs

1 Result monad

type ('a, 'b) t = ('a, 'b) result
val return : 'a -> ('a, 'z) t
val bind : ('a, 'z) t -> ('a -> ('b, 'z) t) -> ('b, 'z) t
val (>>=) : ('a, 'z) t -> ('a -> ('b, 'z) t) -> ('b, 'z) t
val map : ('a -> 'b) -> ('a, 'z) t -> ('b, 'z) t
val (>>|) : ('a, 'z) t -> ('a -> 'b) -> ('b, 'z) t

same as map

val mapM : ('a -> ('b, 'z) t) -> 'a list -> ('b list, 'z) t
val mapM_ : ('a -> (unit, 'z) t) -> 'a list -> (unit, 'z) t
val fold_leftM : ('a -> 'b -> ('a, 'z) t) -> 'a -> 'b list -> ('a, 'z) t
val parseM : ('a -> 'b list -> ('a * 'b list, 'error) t) -> 'a -> 'b list -> ('a, 'error) t
module Op : sig ... end
val map_error : ('err1 -> 'err2) -> ('a, 'err1) t -> ('a, 'err2) t
val from_Ok : ('a, _) t -> 'a

It raises Failure _ when the argument is Error _.

val from_Error : (_, 'e) t -> 'e

It raises Failure _ when the argument is Ok _.

val default : ('a, 'e) t -> ('e -> 'a) -> 'a

Error recovery

val errorf : ('a, unit, string, ('b, string) t) format4 -> 'a

Printf interface to produce a string error

OCaml

Innovation. Community. Security.