Preface_stdlib.Either
Implementation for Either.t
.
Either.t
is the simplest sum type. In addition to allowing the generic description of sum types, it allows the description of a disjunction, for example to generalise a conditional branching.
The set of concrete implementations for Either.t
.
module Bifunctor : Preface_specs.BIFUNCTOR with type ('a, 'b) t = ('a, 'b) t
By setting the left
type of Either.t
it is possible to get implementations for abstractions on constructors of type with an arity of 1.
module Functor
(T : Preface_specs.Types.T0) :
Preface_specs.FUNCTOR with type 'a t = (T.t, 'a) Bifunctor.t
module Alt
(T : Preface_specs.Types.T0) :
Preface_specs.ALT with type 'a t = (T.t, 'a) Bifunctor.t
Either.t
implements Preface_specs.APPLICATIVE
and introduces an interface to define Preface_specs.TRAVERSABLE
using Either
as an iterable structure.
module Applicative
(T : Preface_specs.Types.T0) :
Preface_specs.Traversable.API_OVER_APPLICATIVE
with type 'a t = (T.t, 'a) Bifunctor.t
module Selective
(T : Preface_specs.Types.T0) :
Preface_specs.SELECTIVE with type 'a t = (T.t, 'a) Bifunctor.t
Either.t
implements Preface_specs.MONAD
and introduces an interface to define Preface_specs.TRAVERSABLE
using Either
as an iterable structure.
module Monad
(T : Preface_specs.Types.T0) :
Preface_specs.Traversable.API_OVER_MONAD
with type 'a t = (T.t, 'a) Bifunctor.t
module Invariant
(T : Preface_specs.Types.T0) :
Preface_specs.INVARIANT with type 'a t = (T.t, 'a) Bifunctor.t
module Foldable
(T : Preface_specs.Types.T0) :
Preface_specs.FOLDABLE with type 'a t = (T.t, 'a) Bifunctor.t
Additional functions to facilitate practical work with Either.t
.
val pure : 'b -> ('a, 'b) t
Create a value from 'b
to ('a, 'b) t
, a value wrapped in Right
.
Equality between Either.t
.
val pp :
(Stdlib.Format.formatter -> 'a -> unit) ->
(Stdlib.Format.formatter -> 'b -> unit) ->
Stdlib.Format.formatter ->
('a, 'b) t ->
unit
Formatter for pretty-printing for Either.t
.