package spotlib

  1. Overview
  2. Docs

Build a full Monad interface of T1 from the minimum specification of S1. Note that it only builds functions. The type is not exported.

Parameters

module M : S1

Signature

include Monad_intf.S1 with type 'a t := 'a M.t
val return : 'a -> 'a M.t
val bind : 'a M.t -> ('a -> 'b M.t) -> 'b M.t
include Monad_intf.EX1 with type 'a t := 'a M.t
val fmap : ('a -> 'b) -> 'a M.t -> 'b M.t

fmap in Haskell

val liftM : ('a -> 'b) -> 'a M.t -> 'b M.t

synonym of fmap

val fmap2 : ('a -> 'b -> 'c) -> 'a M.t -> 'b M.t -> 'c M.t

fmap2 in Haskell

val liftM2 : ('a -> 'b -> 'c) -> 'a M.t -> 'b M.t -> 'c M.t

synonym of fmap2

val void : 'a M.t -> unit M.t
val seq : 'a M.t list -> 'a list M.t

sequence in Haskell. Not tail recursive.

val seq_ : unit M.t list -> unit M.t

sequence_ in Haskell. Not tail recursive.

val mapM : ('a -> 'b M.t) -> 'a list -> 'b list M.t

Not tail recursive

val mapM_ : ('a -> unit M.t) -> 'a list -> unit M.t

Not tail recursive

val iteri : (int -> 'a -> unit M.t) -> 'a list -> unit M.t

Iteration with index starting from 0. Not tail recursive.

val for_ : int -> int -> (int -> unit M.t) -> unit M.t

for like iteration. Not tail recursive

val join : 'a M.t M.t -> 'a M.t
include Monad_intf.Infix1 with type 'a t := 'a M.t
val (>>=) : 'a M.t -> ('a -> 'b M.t) -> 'b M.t

synonym of bind

val (>>|) : 'a M.t -> ('a -> 'b) -> 'b M.t

synonum of fmap, with the flipped arguments

Applicative style binops

val (^<$>) : ('a -> 'b) -> 'a M.t -> 'b M.t

same as map, <$> in Haskell

val (/<*>) : ('a -> 'b) M.t -> 'a M.t -> 'b M.t

<*> in Haskell

module S : Monad_intf.S1 with type 'a t := 'a M.t
module EX : Monad_intf.EX1 with type 'a t := 'a M.t
module Infix : Monad_intf.Infix1 with type 'a t := 'a M.t
OCaml

Innovation. Community. Security.