package selective

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include Base.Applicative.S
type 'a t
val return : 'a -> 'a t
val apply : ('a -> 'b) t -> 'a t -> 'b t
val map : 'a t -> f:('a -> 'b) -> 'b t
val map2 : 'a t -> 'b t -> f:('a -> 'b -> 'c) -> 'c t
val map3 : 'a t -> 'b t -> 'c t -> f:('a -> 'b -> 'c -> 'd) -> 'd t
val all : 'a t list -> 'a list t
val all_unit : unit t list -> unit t
val all_ignore : unit t list -> unit t
  • deprecated [since 2018-02] Use [all_unit]
val both : 'a t -> 'b t -> ('a * 'b) t
module Applicative_infix : sig ... end
include module type of Applicative_infix
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

same as apply

val (<*) : 'a t -> unit t -> 'a t
val (*>) : unit t -> 'a t -> 'a t
val select : ('a, 'b) Base.Either.t t -> ('a -> 'b) t -> 'b t
val (<*?) : ('a, 'b) Base.Either.t t -> ('a -> 'b) t -> 'b t

An operator alias for select, which is sometimes convenient. It tries to follow the notational convention for Applicative operators. The angle bracket pointing to the left means we always use the corresponding value. The value on the right, however, may be unnecessary, hence the question mark.

val branch : ('a, 'b) Base.Either.t t -> ('a -> 'c) t -> ('b -> 'c) t -> 'c t

The branch function is a natural generalisation of select: instead of skipping an unnecessary effect, it chooses which of the two given effectful functions to apply to a given argument; the other effect is unnecessary.

val ifS : Base.bool t -> 'a t -> 'a t -> 'a t

Branch on a Boolean value, skipping unnecessary effects.

val whenS : Base.bool t -> Base.unit t -> Base.unit t

Conditionally perform an effect.

val (<||>) : Base.bool t -> Base.bool t -> Base.bool t

A lifted version of lazy Boolean OR.

val (<&&>) : Base.bool t -> Base.bool t -> Base.bool t

A lifted version of lazy Boolean AND.

OCaml

Innovation. Community. Security.