Module Result.Alt

Type

type ('a, 'b) t = ('a, 'b) t

The type held by the Indexed Alt.

Functions

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

Combine two values of t into one.

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

Mapping over t from 'a to 'b.

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.

Infix operators

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

Infix version of CORE.combine

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.

Syntax operators

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

let operator for mapping.