Module Yocaml.Validate
Source A specialised version of Validation
(with a nonempty list of Error.t
as Invalid
part). Validate
is very useful to produce parallel validations, where each error is accumulated, as opposed to Try
which stops the computation at the first error.
TypeSource type 'a t = ('a , Error.t Preface .Nonempty_list.t ) Preface .Validation.t
A specialised version of Validation
.
ConstructorsProduction of valid (Valid
) or invalid (Inavlid
) values.
Produces an invalid value.
Produces an invalid value using an Error
.
ConversionsProduces a Try
from a Validate
.
Produces a Validate
from a Try
.
HelpersPretty-printers for Validate.t
.
Source val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
Equality betweens Validate.t
.
ImplementationSome implementations of some abstractions offered by Preface.
module Functor : Preface .Specs.FUNCTOR with type 'a t = 'a t
Validate
is a Functor
that (logically) implements map
.
module Applicative :
Preface .Specs.Traversable.API_OVER_APPLICATIVE with type 'a t = 'a t
Validate
is an Applicative
that (logically) implements apply
and pure
.
module Alt : Preface .Specs.Alt.API with type 'a t = 'a t
Validate
is an Alt
that (logically) implements combine
.
module Selective : Preface .Specs.SELECTIVE with type 'a t = 'a t
Validate
is a Selective
that (logically) implements select
and branch
.
module Monad : Preface .Specs.Traversable.API_OVER_MONAD with type 'a t = 'a t
Validate
is also a Monad
that (logically) implements bind
and return
.
Infix and Syntax operatorsinclude module type of Infix with type 'a t := 'a t
include Preface .Specs.Alt.INFIX with type 'a t := 'a t
val (<|>) : 'a t -> 'a t -> 'a t
include Preface .Specs.Selective.INFIX with type 'a t := 'a t
val (<*>) : ('a -> 'b ) t -> 'a t -> 'b t
val (<**>) : 'a t -> ('a -> 'b ) t -> 'b t
val (*>) : unit t -> 'a t -> 'a t
val (<*) : 'a t -> unit t -> 'a t
val (<*?) : ('a , 'b ) Preface_core .Shims.Either.t t -> ('a -> 'b ) t -> 'b t
val (<||>) : bool t -> bool t -> bool t
val (<&&>) : bool t -> bool t -> bool t
include Preface .Specs.Monad.INFIX with type 'a t := 'a t
val (=|<) : ('a -> 'b ) -> 'a t -> 'b t
val (>|=) : 'a t -> ('a -> 'b ) -> 'b t
val (>>=) : 'a t -> ('a -> 'b t ) -> 'b t
val (=<<) : ('a -> 'b t ) -> 'a t -> 'b t
val (>=>) : ('a -> 'b t ) -> ('b -> 'c t ) -> 'a -> 'c t
val (<=<) : ('b -> 'c t ) -> ('a -> 'b t ) -> 'a -> 'c t
val (>>) : unit t -> 'b t -> 'b t
val (<<) : 'a t -> unit t -> 'a t
val (<$>) : ('a -> 'b ) -> 'a t -> 'b t
val (<&>) : 'a t -> ('a -> 'b ) -> 'b t
val (<$) : 'a -> 'b t -> 'a t
val ($>) : 'a t -> 'b -> 'b t
include module type of Syntax with type 'a t := 'a t
include Preface .Specs.Selective.SYNTAX with type 'a t := 'a t
val (and+) : 'a t -> 'b t -> ('a * 'b ) t
include Preface .Specs.Monad.SYNTAX with type 'a t := 'a t
val (let*) : 'a t -> ('a -> 'b t ) -> 'b t
val (let+) : 'a t -> ('a -> 'b ) -> 'b t