Parameter Infix.Operation

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

The type held by the Indexed Selective.

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

Mapping over t from 'a to 'b.

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 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 if_ : (bool, 'index) t -> ('a, 'index) t -> ('a, 'index) t -> ('a, 'index) t

Same of branch but using a Boolean as disjunction.

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

Monad bind specialized for Boolean.

val when_ : (bool, 'index) t -> (unit, 'index) t -> (unit, 'index) t

Conditionally perform an effect.

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

Selective version of List.exists.

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

Selective version of List.for_all.

val or_ : (bool, 'index) t -> (bool, 'index) t -> (bool, 'index) t

Or combinator.

val and_ : (bool, 'index) t -> (bool, 'index) t -> (bool, 'index) t

And combinator.

val while_ : (bool, 'index) t -> (unit, 'index) t

Keep checking an effectful condition while it holds.