Module type Arrow_choice.API

The complete interface of an Arrow_choice.

Type

type ('a, 'b) t

The type held by the Arrow_choice.

Functions

val left : ('a, 'b) t -> (('a, 'c) Stdlib.Either.t, ('b, 'c) Stdlib.Either.t) t

Feed marked inputs through the argument arrow, passing the rest through unchanged to the output.

val choose : ('a, 'b) t -> ('c, 'd) t -> (('a, 'c) Stdlib.Either.t, ('b, 'd) Stdlib.Either.t) t

Split the input between the two argument arrows, re-tagging and merging their outputs.

include Category.WITH_ID with type ('a, 'b) t := ('a, 'b) t
val id : ('a, 'a) t

The identity morphism.

include Semigroupoid.WITH_COMPOSE with type ('a, 'b) t := ('a, 'b) t
val compose : ('b, 'c) t -> ('a, 'b) t -> ('a, 'c) t

Morphism composition (from right to left).

val fst : ('a, 'b) t -> ('a * 'd, 'b * 'd) t

Send the first component of the input through the argument Arrow, and copy the rest unchanged to the output.

val arrow : ('a -> 'b) -> ('a, 'b) t

Lift a function to an Arrow.

val split : ('a, 'b) t -> ('c, 'd) t -> ('a * 'c, 'b * 'd) t

Split the input between the two given Arrows and combine their output.

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

An alias of CORE.compose.

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

An alias of CORE.compose with flipped argument.

val return : unit -> ('a, 'a) t

Represent the identity Arrow.

val snd : ('a, 'b) t -> ('d * 'a, 'd * 'b) t

Send the second component of the input through the given Arrow, and copy the rest unchanged to the output.

val fan_out : ('a, 'b) t -> ('a, 'c) t -> ('a, 'b * 'c) t

Send the input to both argument arrows and combine their output.

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

Pre composition with a function (the function should be pure).

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

Post composition with a function (the function should be pure).

val pre_compose_right_to_left : ('b, 'c) t -> ('a -> 'b) -> ('a, 'c) t
val post_compose_right_to_left : ('b -> 'c) -> ('a, 'b) t -> ('a, 'c) t
val right : ('a, 'b) t -> (('c, 'a) Stdlib.Either.t, ('c, 'b) Stdlib.Either.t) t

The mirror image of left.

val fan_in : ('a, 'c) t -> ('b, 'c) t -> (('a, 'b) Stdlib.Either.t, 'c) t

Split the input between the two argument arrows and merge their outputs.

Infix operators

module Infix : INFIX with type ('a, 'b) t := ('a, 'b) t
val (%) : ('b, 'c) t -> ('a, 'b) t -> ('a, 'c) t

An alias of CORE.compose (to be iso with Preface_core).

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

An alias of CORE.compose (to be iso with Preface_core).

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

An alias of OPERATION.compose_left_to_right (to be iso with Preface_core).

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

An alias of CORE.compose (to be iso with Haskell's approach). Even <<< looks like <% (it is an alias for the same function), they differ in their priorities. OCaml documentation of operators priorities

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

An alias of CORE.compose_left_to_right (to be iso with Haskell's approach). Even >>> looks like %> (it is an alias for the same function), they differ in their priorities. OCaml documentation of operators priorities

val (***) : ('a, 'b) t -> ('c, 'd) t -> ('a * 'c, 'b * 'd) t
val (&&&) : ('a, 'b) t -> ('a, 'c) t -> ('a, 'b * 'c) t
val (^>>) : ('a -> 'b) -> ('b, 'c) t -> ('a, 'c) t
val (>>^) : ('a, 'b) t -> ('b -> 'c) -> ('a, 'c) t
val (<<^) : ('b, 'c) t -> ('a -> 'b) -> ('a, 'c) t
val (^<<) : ('b -> 'c) -> ('a, 'b) t -> ('a, 'c) t
val (+++) : ('a, 'b) t -> ('c, 'd) t -> (('a, 'c) Stdlib.Either.t, ('b, 'd) Stdlib.Either.t) t

Infix version of CORE.choose.

val (|||) : ('a, 'c) t -> ('b, 'c) t -> (('a, 'b) Stdlib.Either.t, 'c) t

Infix version of CORE.fan_in.