Module type Alt.API

The complete interface of an Alt.

Type

type 'a t

The type held by the Alt.

Type

Functions

val combine : 'a t -> 'a t -> 'a t

Combine two values of t into one.

val map : ('a -> 'b) -> 'a t -> 'b t

Mapping over t from 'a to 'b.

val times_nel : int -> 'a t -> 'a 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 t Preface_core.Nonempty_list.t -> 'a t

Reduce a Nonempty_list.t using combine.

val replace : 'a -> 'b t -> 'a t

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

val void : 'a t -> unit t

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

Infix operators

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

Infix version of CORE.combine

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

Infix version of CORE.map.

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

Flipped and infix version of CORE.map.

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

Infix version of OPERATION.replace.

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

Flipped and infix version of OPERATION.replace.

Syntax operators

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

let operator for mapping.