package spotlib

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

Module Monad.Make2Source

Build a full Monad interface of data type with 2 parameters, T2, from the minimum specification of S2. Note that it only builds functions. The type is not exported.

Parameters

module M : S2

Signature

include T2 with type ('a, 'z) t := ('a, 'z) M.t
val return : 'a -> ('a, 'z) M.t
val bind : ('a, 'z) M.t -> ('a -> ('b, 'z) M.t) -> ('b, 'z) M.t
Sourceval fmap : ('a -> 'b) -> ('a, 'z) M.t -> ('b, 'z) M.t

fmap in Haskell

Sourceval liftM : ('a -> 'b) -> ('a, 'z) M.t -> ('b, 'z) M.t

Synonym of fmap

Sourceval fmap2 : ('a -> 'b -> 'c) -> ('a, 'z) M.t -> ('b, 'z) M.t -> ('c, 'z) M.t

fmap2 in Haskell

Sourceval liftM2 : ('a -> 'b -> 'c) -> ('a, 'z) M.t -> ('b, 'z) M.t -> ('c, 'z) M.t

synonym of fmap2 in Haskell

Sourceval void : ('a, 'z) M.t -> (unit, 'z) M.t
Sourceval seq : ('a, 'z) M.t list -> ('a list, 'z) M.t

sequence in Haskell. Not tail recursive.

Sourceval seq_ : (unit, 'z) M.t list -> (unit, 'z) M.t

sequence_ in Haskell. Not tail recursive.

Sourceval mapM : ('a -> ('b, 'z) M.t) -> 'a list -> ('b list, 'z) M.t

Not tail recursive by default

Sourceval mapM_ : ('a -> (unit, 'z) M.t) -> 'a list -> (unit, 'z) M.t

Not tail recursive by default

Sourceval iteri : (int -> 'a -> (unit, 'z) M.t) -> 'a list -> (unit, 'z) M.t

Iteration with index starting from 0. Not tail recursive by default.

Sourceval for_ : int -> int -> (int -> (unit, 'z) M.t) -> (unit, 'z) M.t

for like iteration. Not tail recursive by default

Sourceval join : (('a, 'z) M.t, 'z) M.t -> ('a, 'z) M.t
Sourceval prod : ('a, 'z) M.t -> ('b, 'z) M.t -> ('a * 'b, 'z) M.t
Sourcemodule Infix : Infix2 with type ('a, 'z) t := ('a, 'z) M.t
Sourcemodule Syntax : Syntax2 with type ('a, 'z) t := ('a, 'z) M.t
OCaml

Innovation. Community. Security.