Parameter Suite_left_absorption.F

Type

type ('a, 'index) t = ('a, 'index) R.t

The type held by the Indexed Monad Plus.

Functions

include Preface_specs.Indexed_monad.WITH_RETURN with type ('a, 'index) t := ('a, 'index) t
include Preface_specs.Indexed_bind.WITH_BIND with type ('a, 'index) t := ('a, 'index) t
val bind : ('a -> ('b, 'index) t) -> ('a, 'index) t -> ('b, 'index) t

bind f m passes the result of computation m to function f.

include Preface_specs.Indexed_monad.WITH_RETURN with type ('a, 'index) t := ('a, 'index) t
include Preface_specs.Indexed_bind.WITH_MAP_AND_JOIN with type ('a, 'index) t := ('a, 'index) t
val map : ('a -> 'b) -> ('a, 'index) t -> ('b, 'index) t

Mapping over from 'a to 'b.

val join : (('a, 'index) t, 'index) t -> ('a, 'index) t

join remove one level of monadic structure, projecting its bound argument into the outer level.

include Preface_specs.Indexed_monad.WITH_RETURN with type ('a, 'index) t := ('a, 'index) t
val return : 'a -> ('a, 'index) t

Lift a value into a t.

include Preface_specs.Indexed_bind.WITH_KLEISLI_COMPOSITION with type ('a, 'index) t := ('a, 'index) t
val compose_left_to_right : ('a -> ('b, 'index) t) -> ('b -> ('c, 'index) t) -> 'a -> ('c, 'index) t

Composing monadic functions using Kleisli Arrow (from left to right).

val combine : ('a, 'index) t -> ('a, 'index) t -> ('a, 'index) t

Combine two values of t into one.

val neutral : ('a, 'index) t

The neutral element of the t.

val compose_right_to_left : ('b -> ('c, 'index) t) -> ('a -> ('b, 'index) t) -> 'a -> ('c, 'index) t

Composing monadic functions using Kleisli Arrow (from right to left).

val lift : ('a -> 'b) -> ('a, 'index) t -> ('b, 'index) t

Mapping over t from 'a to 'b.

val lift2 : ('a -> 'b -> 'c) -> ('a, 'index) t -> ('b, 'index) t -> ('c, 'index) t

Lift a binary function that acts on arbitrary values into a function that acts t values.

val lift3 : ('a -> 'b -> 'c -> 'd) -> ('a, 'index) t -> ('b, 'index) t -> ('c, 'index) t -> ('d, 'index) t

Lift a ternary function that acts on arbitrary values into a function that acts t values.

val times_nel : int -> ('a, 'index) t -> ('a, 'index) t option

times_nel n x apply combine on x n times. If n is lower than 1 the function will returns None.

val reduce_nel : ('a, 'index) t Preface_core.Nonempty_list.t -> ('a, 'index) t

Reduce a Nonempty_list.t using combine.

val replace : 'a -> ('b, 'index) t -> ('a, 'index) t

Create a new t, replacing all values of the given functor by given a value of 'a.

val void : ('a, 'index) t -> (unit, 'index) t

Create a new t, replacing all values in the given functor by unit.

val times : int -> ('a, 'index) t -> ('a, 'index) t

times n x apply combine on x n times. If n is lower than 1 the function will returns neutral.

val reduce : ('a, 'index) t list -> ('a, 'index) t

Reduce a List.t using combine.

val filter : ('a -> bool) -> ('a, 'index) t -> ('a, 'index) t

Filtering over Monad_plus.

Infix operators

module Infix : Preface_specs.Indexed_monad_plus.INFIX with type ('a, 'index) t := ('a, 'index) t
val (=|<) : ('a -> 'b) -> ('a, 'index) t -> ('b, 'index) t

Infix version of CORE.map.

val (>|=) : ('a, 'index) t -> ('a -> 'b) -> ('b, 'index) t

Infix flipped version of CORE.map.

val (>>=) : ('a, 'index) t -> ('a -> ('b, 'index) t) -> ('b, 'index) t

Infix flipped version of CORE.bind.

val (=<<) : ('a -> ('b, 'index) t) -> ('a, 'index) t -> ('b, 'index) t

Infix version of CORE.bind.

val (>=>) : ('a -> ('b, 'index) t) -> ('b -> ('c, 'index) t) -> 'a -> ('c, 'index) t

Infix version of CORE.compose_left_to_right.

val (<=<) : ('b -> ('c, 'index) t) -> ('a -> ('b, 'index) t) -> 'a -> ('c, 'index) t

Infix version of OPERATION.compose_right_to_left.

val (>>) : (unit, 'index) t -> ('b, 'index) t -> ('b, 'index) t

Sequentially compose two actions, discarding any value produced by the first.

val (<<) : ('a, 'index) t -> (unit, 'index) t -> ('a, 'index) t

Sequentially compose two actions, discarding any value produced by the second.

val (<$>) : ('a -> 'b) -> ('a, 'index) t -> ('b, 'index) t

Infix version of CORE.map.

val (<&>) : ('a, 'index) t -> ('a -> 'b) -> ('b, 'index) t

Flipped and infix version of CORE.map.

val (<$) : 'a -> ('b, 'index) t -> ('a, 'index) t

Infix version of OPERATION.replace.

val ($>) : ('a, 'index) t -> 'b -> ('b, 'index) t

Flipped and infix version of OPERATION.replace.

val (<|>) : ('a, 'index) t -> ('a, 'index) t -> ('a, 'index) t

Infix version of CORE.combine.

Syntax

module Syntax : Preface_specs.Indexed_monad_plus.SYNTAX with type ('a, 'index) t := ('a, 'index) t
val let* : ('a, 'index) t -> ('a -> ('b, 'index) t) -> ('b, 'index) t

Syntactic shortcuts for flipped version of CORE.bind:

let* x = e in f is equals to bind (fun x -> f) e.

val let+ : ('a, 'index) t -> ('a -> 'b) -> ('b, 'index) t

let operator for mapping.