module Fun: CCFunval (|>) : 'a -> ('a -> 'b) -> 'bx |> f is the same as f x.val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'cval compose_binop : ('a -> 'b) -> ('b -> 'b -> 'c) -> 'a -> 'a -> 'ccompose_binop f g is fun x y -> g (f x) (f y)
Example (partial order):
List.sort (compose_binop fst CCInt.compare) [1, true; 2, false; 1, false]val (%>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'ccomposeval (@@) : ('a -> 'b) -> 'a -> 'bf @@ x is the same as f x, but right-associative.val id : 'a -> 'aval const : 'a -> 'b -> 'aconst x y = x for any yval flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'cval curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
val uncurry : ('a -> 'b -> 'c) -> 'a * 'b -> 'c
val tap : ('a -> 'b) -> 'a -> 'atap f x evaluates f x, discards it, then returns x. Useful
in a pipeline, for instance:
CCArray.(1 -- 10)
|> tap CCArray.shuffle
|> tap CCArray.sort Pervasives.compare
val (%) : ('b -> 'c) -> ('a -> 'b) -> 'a -> 'cval lexicographic : ('a -> 'a -> int) -> ('a -> 'a -> int) -> 'a -> 'a -> intval finally : h:(unit -> 'b) -> f:(unit -> 'a) -> 'afinally h f calls f () and returns its result. If it raises, the
same exception is raised; in any case, h () is called after
f () terminates.val finally1 : h:(unit -> 'c) -> ('a -> 'b) -> 'a -> 'bfinally1 ~h f x is the same as f x, but after the computation,
h () is called whether f x rose an exception or not.val finally2 : h:(unit -> 'd) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'cfinally2 ~h f x y is the same as f x y, but after the computation,
h () is called whether f x y rose an exception or not.val opaque_identity : 'a -> 'aopaque_identity x is like x, but prevents Flambda from using x's
definition for optimizing it (flambda is an optimization/inlining pass
in OCaml >= 4.03).
Functions with a fixed domain are monads in their codomain
module Monad(X:sigtypetend):sig..end