Module B0.R

module R: sig .. end
Result value combinators.

Composing results

val reword_error : ('b -> 'c) -> ('a, 'b) Pervasives.result -> ('a, 'c) Pervasives.result
reword_error reword r is:
val join : (('a, 'b) Pervasives.result, 'b) Pervasives.result ->
('a, 'b) Pervasives.result
join r is v if r = Ok v and r otherwise.

Error messages

type msg = [ `Msg of string ] 
The type for (error) messages.
val msgf : ('a, Format.formatter, unit, [> msg ]) Pervasives.format4 -> 'a
msgf fmt ... is a B0.R.msg formatted according to fmt.
val error_msg : string -> ('b, [> msg ]) Pervasives.result
error_msg s is Error (`Msg s).
val error_msgf : ('a, Format.formatter, unit, ('b, [> msg ]) Pervasives.result)
Pervasives.format4 -> 'a
error_msgf fmt ... is an error formatted according to fmt.
val reword_error_msg : ?replace:bool ->
(string -> msg) ->
('a, msg) Pervasives.result -> ('a, [> msg ]) Pervasives.result
reword_error_msg ~replace reword r is like B0.R.reword_error except if replace is false (default), the result of reword old_msg is concatened, on a new line to the old message.
val open_error_msg : ('a, msg) Pervasives.result -> ('a, [> msg ]) Pervasives.result
open_error_msg r allows to combine a closed error message variant with other variants.
val failwith_error_msg : ('a, msg) Pervasives.result -> 'a
failwith_error_msg r raises Failure m if r is Error (`Msg m)