package base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Various combinators for functions.

val (|>) : 'a -> ('a -> 'b) -> 'b

A "pipe" operator. x |> f is equivalent to f x.

See ppx_pipebang for further details.

val const : 'a -> _ -> 'a

Produces a function that just returns its first argument.

val ignore : _ -> unit

Ingores its argument and returns ().

val non : ('a -> bool) -> 'a -> bool

Negates a boolean function.

val forever : (unit -> unit) -> exn

forever f runs f () until it throws an exception and returns the exception. This function is useful for read_line loops, etc.

val apply_n_times : n:int -> ('a -> 'a) -> 'a -> 'a

apply_n_times ~n f x is the n-fold application of f to x.

val id : 'a -> 'a

The identity function.

See also: Sys.opaque_identity.

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

compose f g x is f (g x).

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

Reverses the order of arguments for a binary function.

OCaml

Innovation. Community. Security.