package preface

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Preface_stdlib.ResultSource

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

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

Implementation

Bifunctor

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

Delayed implementation

By setting the error type of Result.t it is possible to get implementations for abstractions on constructors of type with an arity of 1.

Functor

Alt

Invariant

Applicative

Result.t implements Preface_specs.APPLICATIVE and introduces an interface to define Preface_specs.TRAVERSABLE using Result as an iterable structure.

Selective

Monad

Result.t implements Preface_specs.MONAD and introduces an interface to define Preface_specs.TRAVERSABLE using Result as an iterable structure.

Foldable

Additional functions

Additional functions to facilitate practical work with Result.t.

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

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

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

Equality between Result.t.

Sourceval pp : (Format.formatter -> 'a -> unit) -> (Format.formatter -> 'b -> unit) -> Format.formatter -> ('a, 'b) t -> unit

Formatter for pretty-printing for Result.t.

OCaml

Innovation. Community. Security.