package soteria

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

Module Soteria_std.Monad

Monad interfaces and implementations.

Module Types

Monads with one type parameter

module type Base = sig ... end

Basic interface for a monad with one type parameter.

module type Syntax = sig ... end

Syntax extension for monads (let* and let+).

module type Extension = sig ... end
module type S = sig ... end

Complete monad interface including generic operations and syntax.

Monads with two type parameters

module type Base2 = sig ... end

Basic interface for a monad with two type parameters (e.g. Result).

module type Syntax2 = sig ... end

Syntax extension for two-parameter monads.

module type Extension2 = sig ... end
module type S2 = sig ... end

Complete interface for two-parameter monads.

Lifters and implementations

val foldM : (module M : Soteria_std.Sigs.Foldable) -> return:('a -> 'b) -> bind:(('c -> 'd) -> 'b -> 'b) -> 'e M.t -> init:'a -> f:('c -> 'e -> 'd) -> 'b

Generic monadic fold function.

val iterM : (module M : Soteria_std.Sigs.Foldable) -> return:(unit -> 'a) -> bind:((unit -> 'b) -> 'a -> 'a) -> 'c M.t -> f:('c -> 'b) -> 'a
val mapM : (module M : Soteria_std.Sigs.Foldable) -> return:('a list -> 'b) -> bind:(('a list -> 'b) -> 'b -> 'b) -> map:(('a -> 'a list) -> 'c -> 'b) -> 'd M.t -> f:('d -> 'c) -> 'b
val all : return:('a list -> 'b) -> bind:(('a -> 'b) -> 'c -> 'b) -> ('d -> 'c) -> 'd list -> 'b

Generic monadic map function that collects results.

module Make_extension (Base : Base) : Extension with type 'a t := 'a Base.t
module Make_syntax (Base : Base) : Syntax with type 'a t = 'a Base.t

Syntax extension for monads (let* and let+).

module Extend (Base : Base) : S with type 'a t = 'a Base.t

Complete monad interface including generic operations and syntax.

module Make_extension2 (Base : sig ... end) : Extension2 with type ('a, 'b) t := ('a, 'b) Base.t
module Make_syntax2 (Base : Base2) : Syntax2 with type ('a, 'b) t = ('a, 'b) Base.t

Syntax extension for two-parameter monads.

module Extend2 (Base : Base2) : S2 with type ('a, 'b) t = ('a, 'b) Base.t

Complete interface for two-parameter monads.

module Id : sig ... end

Identity monad.

module ResultT (M : Base) : Base2 with type ('a, 'b) t = ('a, 'b) Result.t M.t

Result transformer.

module ListM : sig ... end

List monad.

module ResultM : sig ... end

Result monad.

module OptionM : sig ... end

Option monad.

module SeqM : sig ... end

Sequence monad.

module IterM : sig ... end

Iterator monad.

module StateM (State : sig ... end) : sig ... end

State monad.

module StateT_base (State : sig ... end) (M : Base) : sig ... end

State monad transformer.

module StateT_p (M : Base) : sig ... end

State monad transformer with polymorphic state.