Module Preface_stdlib.Result

Implementation for Result.t.

Result.t is like Either.t but it exist for semantic reasons. (Left and Right are not very specific on what are the valid and the invalid branch).

Type

type ('a, 'b) t = ('a, 'b) Stdlib.result =
  1. | Ok of 'a
  2. | Error of 'b

Implementation

Bifunctor

module Bifunctor : Preface_specs.BIFUNCTOR with type ('a, 'b) t = ('a, 'b) t

Functor

module Functor : Preface_specs.INDEXED_FUNCTOR with type ('a, 'b) t = ('a, 'b) t

Alt

module Alt : Preface_specs.INDEXED_ALT with type ('a, 'b) t = ('a, 'b) t

Applicative

module Applicative : Preface_specs.INDEXED_APPLICATIVE with type ('a, 'b) t = ('a, 'b) t

Selective

module Selective : Preface_specs.INDEXED_SELECTIVE with type ('a, 'b) t = ('a, 'b) t

Monad

module Monad : Preface_specs.INDEXED_MONAD with type ('a, 'b) t = ('a, 'b) t

Foldable

module Foldable : Preface_specs.INDEXED_FOLDABLE with type ('a, 'b) t = ('a, 'b) t
module Mono (T : Preface_specs.Types.T0) : sig ... end

Additional functions

Additional functions to facilitate practical work with Result.t.

val pure : 'a -> ('a, 'b) t

Create a value from 'b to ('a, 'b) t.

val equal : ('a -> 'a -> bool) -> ('b -> 'b -> bool) -> ('a, 'b) t -> ('a, 'b) t -> bool

Equality between Result.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 Result.t.