mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
Make use new Stdlib.Fun to extend / replace CCFun
This commit is contained in:
parent
2d5f0e3e8d
commit
858af75ee8
2 changed files with 3 additions and 16 deletions
|
|
@ -14,19 +14,14 @@ let opaque_identity x = x
|
|||
|
||||
include Sys
|
||||
include CCShims_.Stdlib
|
||||
include Fun
|
||||
|
||||
let compose f g x = g (f x)
|
||||
|
||||
let compose_binop f g x y = g (f x) (f y)
|
||||
|
||||
let flip f x y = f y x
|
||||
|
||||
let curry f x y = f (x,y)
|
||||
|
||||
let id x = x
|
||||
|
||||
let const x _ = x
|
||||
|
||||
let uncurry f (x,y) = f x y
|
||||
|
||||
let tap f x = ignore (f x); x
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
(** {1 Basic Functions} *)
|
||||
|
||||
include module type of CCShims_.Stdlib.Fun
|
||||
|
||||
val (|>) : 'a -> ('a -> 'b) -> 'b
|
||||
(** A 'pipe' operator. [x |> f] is the same as [f x]. *)
|
||||
|
||||
|
|
@ -22,16 +24,6 @@ val (@@) : ('a -> 'b) -> 'a -> 'b
|
|||
(** [f @@ x] is the same as [f x], but right-associative.
|
||||
@since 0.5 *)
|
||||
|
||||
val id : 'a -> 'a
|
||||
(** Identity function. *)
|
||||
|
||||
val const : 'a -> 'b -> 'a
|
||||
(** Produce a function that just returns its first argument.
|
||||
[const x y = x] for any [y]. *)
|
||||
|
||||
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
|
||||
(** Reverse the order of arguments for a binary function. *)
|
||||
|
||||
val curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
|
||||
(** Convert a function which accepts a pair of arguments into a function which accepts two arguments.
|
||||
[curry f x y] is [f (x,y)]. *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue