package base

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

Module Base.MonadSource

A monad is an abstraction of the concept of sequencing of computations. A value of type 'a monad represents a computation that returns a value of type 'a.

Sourcemodule type Basic = sig ... end
Sourcemodule type Basic2 = sig ... end

Multi parameter monad. The second parameter gets unified across all the computation. This is used to encode monads working on a multi parameter data structure like (('a,'b) result).

Sourcemodule type Basic3 = sig ... end

Multi parameter monad. The second and third parameters get unified across all the computation.

Sourcemodule type Basic_indexed = sig ... end

Indexed monad, in the style of Atkey. The second and third parameters are composed across all computation. To see this more clearly, you can look at the type of bind:

Sourcemodule type Infix = sig ... end
Sourcemodule type Infix2 = sig ... end

Same as Infix, except the monad type has two arguments. The second is always just passed through.

Sourcemodule type Infix3 = sig ... end

Same as Infix, except the monad type has three arguments. The second and third are always just passed through.

Sourcemodule type Infix_indexed = sig ... end

Same as Infix, except the monad type has three arguments. The second and third are composed across all computation.

Sourcemodule type Syntax = sig ... end

Opening a module of this type allows one to use the %bind and %map syntax extensions defined by ppx_let, and brings return into scope.

Sourcemodule type Syntax2 = sig ... end
Sourcemodule type Syntax3 = sig ... end
Sourcemodule type Syntax_indexed = sig ... end
Sourcemodule type S_without_syntax = sig ... end
Sourcemodule type S = sig ... end
Sourcemodule type S2 = sig ... end

The same as S except the monad type has two arguments. The second is always just passed through.

Sourcemodule type S3 = sig ... end

The same as S except the monad type has three arguments. The second and third are always just passed through.

Sourcemodule type S_indexed = sig ... end

The same as S except the monad type has three arguments. The second and third are composed across all computation.

Sourcemodule Make (X : Basic) : S with type 'a t := 'a X.t
Sourcemodule Make2 (X : Basic2) : S2 with type ('a, 'e) t := ('a, 'e) X.t

The same as S except the monad type has two arguments. The second is always just passed through.

Sourcemodule Make3 (X : Basic3) : S3 with type ('a, 'd, 'e) t := ('a, 'd, 'e) X.t

The same as S except the monad type has three arguments. The second and third are always just passed through.

Sourcemodule Make_indexed (X : Basic_indexed) : S_indexed with type ('a, 'd, 'e) t := ('a, 'd, 'e) X.t

The same as S except the monad type has three arguments. The second and third are composed across all computation.

Sourcemodule Of_monad (Monad : S) (M : sig ... end) : S with type 'a t := 'a M.t

Define a monad through an isomorphism with an existing monad. For example:

Sourcemodule Of_monad2 (Monad : S2) (M : sig ... end) : S2 with type ('a, 'b) t := ('a, 'b) M.t

The same as S except the monad type has two arguments. The second is always just passed through.

Sourcemodule Of_monad3 (Monad : S3) (M : sig ... end) : S3 with type ('a, 'b, 'c) t := ('a, 'b, 'c) M.t

The same as S except the monad type has three arguments. The second and third are always just passed through.

Sourcemodule Of_monad_indexed (Monad : S_indexed) (M : sig ... end) : S_indexed with type ('a, 'i, 'j) t := ('a, 'i, 'j) M.t

The same as S except the monad type has three arguments. The second and third are composed across all computation.

Sourcemodule Ident : S with type 'a t = 'a
OCaml

Innovation. Community. Security.