CCFun.id and const

This commit is contained in:
Simon Cruanes 2014-05-20 17:43:56 +02:00
parent d9ccb619a1
commit 48839be132
2 changed files with 10 additions and 0 deletions

View file

@ -34,6 +34,10 @@ 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 (%>) = compose

View file

@ -35,6 +35,12 @@ val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
val (%>) : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
(** Alias to [compose] *)
val id : 'a -> 'a
(** Identity function *)
val const : 'a -> 'b -> 'a
(** [const x y = x] for any [y] *)
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
(** flip arguments *)