Preface_stdlib.TryImplementation for Try.t.
Try.t is a biased version of Result with the error fixed as an exception.
module Functor : Preface_specs.FUNCTOR with type 'a t = 'a tmodule Alt : Preface_specs.ALT with type 'a t = 'a tTry.t implements Preface_specs.APPLICATIVE and introduces an interface to define Preface_specs.TRAVERSABLE using Try as an iterable structure.
module Applicative :
Preface_specs.Traversable.API_OVER_APPLICATIVE with type 'a t = 'a tmodule Selective : Preface_specs.SELECTIVE with type 'a t = 'a tTry.t implements Preface_specs.MONAD and introduces an interface to define Preface_specs.TRAVERSABLE using Try as an iterable structure.
module Monad : Preface_specs.Traversable.API_OVER_MONAD with type 'a t = 'a tmodule Foldable : Preface_specs.FOLDABLE with type 'a t = 'a tmodule Invariant : Preface_specs.INVARIANT with type 'a t = 'a tAdditional functions to facilitate practical work with Try.t.
val pure : 'a -> 'a tCreate a value from 'a to 'a t.
val ok : 'a -> 'a tWrap a value into Ok.
val error : exn -> 'a tWrap an exception into Error.
val capture : (unit -> 'a) -> 'a tcapture f perform f and wrap the result into a t if the execution of f raise no exception, the result will be Ok result else, the caught exception if wrapped into Error exn.
val case : ('a -> 'b) -> (exn -> 'b) -> 'a t -> 'bcase f g x apply f if x is Ok, g if x is Error.
val to_validation : 'a t -> ('a, exn Nonempty_list.t) Validation.tProject a Try into a Validation.
val pp :
(Stdlib.Format.formatter -> 'a -> unit) ->
Stdlib.Format.formatter ->
'a t ->
unitFormatter for pretty-printing for Try.t.