package core_kernel

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

Extends Base.Fn.

include module type of struct include Base.Fn end
val (|>) : 'a -> ('a -> 'b) -> 'b

A "pipe" operator.

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

Produces a function that just returns its first argument.

val ignore : _ -> unit

ignore is the same as Pervasives.ignore. It is useful to have here so that code that rebinds ignore can still refer to Fn.ignore.

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

Negates a 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. Also see 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.

val (|!) : 'a -> ('a -> 'b) -> 'b
  • deprecated [since 2016-07] Use [ |> ]
OCaml

Innovation. Community. Security.