Preface_stdlib.ValidateSourceImplementation for Try.t.
Validate.t is a biased version of Validation with the errors fixed as an Nonempty_list of exception.
Validate is a specialisation of Validation, so the module does not re-export the Validation constructors (they do not have the same arity) so if you want to pattern match a Validate value you will have to use the Validation constructors:
match validated_value with
| Validation.Valid x -> x
| Validation.Invalid errors ->
Format.sprintf "Error: %a" (Nonempty_list.pp Exn.pp) errorsmodule Functor : Preface_specs.FUNCTOR with type 'a t = 'a tmodule Alt : Preface_specs.ALT with type 'a t = 'a tValidate.t implements Preface_specs.APPLICATIVE and introduces an interface to define Preface_specs.TRAVERSABLE using Validate as an iterable structure.
As you can see, it is in the definition of the Preface_specs.APPLICATIVE that Validate differs from Try. The 'errors part must be a Preface_specs.SEMIGROUP to allow for the accumulation of errors.
Validate.t implements Preface_specs.MONAD and introduces an interface to define Preface_specs.TRAVERSABLE using Validate as an iterable structure.
module Foldable : Preface_specs.FOLDABLE with type 'a t = 'a tAdditional functions to facilitate practical work with Validate.t.
Wrap an exception list into Invalid.
case f g x apply f if x is Valid, g if x is Invalid.
Project a Validate into a Result.
Formatter for pretty-printing for Validate.t.