Module Preface_stdlib.Fun

Implementation for function 'a -> 'b.

Type

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

Implementation

Profunctor

module Profunctor : Preface_specs.PROFUNCTOR with type ('a, 'b) t = ('a, 'b) t

Strong Profunctor

module Strong : Preface_specs.STRONG with type ('a, 'b) t = ('a, 'b) t

Choice Profunctor

module Choice : Preface_specs.CHOICE with type ('a, 'b) t = ('a, 'b) t

Closed Profunctor

module Closed : Preface_specs.CLOSED with type ('a, 'b) t = ('a, 'b) t

Semigroupoid

module Semigroupoid : Preface_specs.SEMIGROUPOID with type ('a, 'b) t = ('a, 'b) t

Category

module Category : Preface_specs.CATEGORY with type ('a, 'b) t = ('a, 'b) t

Arrow

module Arrow : Preface_specs.ARROW with type ('a, 'b) t = ('a, 'b) t

Arrow Choice

module Arrow_choice : Preface_specs.ARROW_CHOICE with type ('a, 'b) t = ('a, 'b) t

Arrow Apply

module Arrow_apply : Preface_specs.ARROW_APPLY with type ('a, 'b) t = ('a, 'b) t

Additional functions

Additional functions to facilitate practical work with Fun.t.

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

(compose_left_to_right f g) x is g (f x).

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

(compose_right_to_left f g) x is f (g x). It is the mathematical composition.

val const : 'a -> 'b -> 'a

Produce a function that returns its first argument. const a b returns always a.

val id : 'a -> 'a

Identity function.

val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c

flip f x y is f y x.

Infix operators

module Infix : sig ... end
val (%>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c

(f %> g) x is g (f x). Alias for Preface_stdlib.Fun.compose_left_to_right

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

(f <% g) x is f (g x). Alias for Preface_stdlib.Fun.compose_right_to_left

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

(f <% g) x is f (g x). Alias for Preface_stdlib.Fun.compose_right_to_left