package monads

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

The Result Monad.

The result monad is a generalization of the Option monad, where the bottom type can bear an arbitrary value of type 'e. The type 'e is fixed and can not be changed during the computation.

Monad.Result.Error is a specialization of the Result monad where 'e is fixed to Error.t.

Monad.Result.Exception is another specialization that fixes 'e to the exn type.

type ('a, 'e) result = ('a, 'e) Core_kernel.Result.t =
  1. | Ok of 'a
  2. | Error of 'e
module type S = sig ... end
module type S2 = sig ... end
module T1 (T : Core_kernel.T) (M : Monad) : sig ... end
module T2 (M : Monad) : sig ... end
module Make (T : Core_kernel.T) (M : Monad) : S with type 'a t := 'a T1(T)(M).t and type 'a m := 'a T1(T)(M).m and type 'a e := 'a T1(T)(M).e and type err := T.t

Make(E)(M) concretized the type of error to E.t and composes the Result monad with the monad M.

module Make2 (M : Monad) : S2 with type ('a, 'e) t := ('a, 'e) T2(M).t and type 'a m := 'a T2(M).m and type ('a, 'e) e := ('a, 'e) T2(M).e

Make2(M) composes the result monad with the monad M.

module Error : sig ... end

The Error monad.

module Exception : sig ... end

The Exception monad.

OCaml

Innovation. Community. Security.