Create CCEqualLabels

This commit is contained in:
Christopher Zimmermann 2018-10-11 20:20:21 +02:00 committed by Simon Cruanes
parent c6a3fe86eb
commit f02f291c7a
5 changed files with 57 additions and 0 deletions

View file

@ -1,3 +1,5 @@
(* AUTOGENERATED FROM CCEqualLabels.mli *)
(* This file is free software, part of containers. See file "license" for more details. *) (* This file is free software, part of containers. See file "license" for more details. *)

View file

@ -0,0 +1,4 @@
(* This file is free software, part of containers. See file "license" for more details. *)
include CCEqual

View file

@ -0,0 +1,44 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Equality Combinators} *)
(** @since 1.2 *)
type 'a t = 'a -> 'a -> bool
(** Equality function. Must be transitive, symmetric, and reflexive. *)
val poly : 'a t
(** Standard polymorphic equality. *)
val physical : 'a t
(** Standard physical equality.
@since 2.0 *)
val int : int t
val string : string t
val bool : bool t
val float : float t
val unit : unit t
val list : 'a t -> 'a list t
val array : 'a t -> 'a array t
val option : 'a t -> 'a option t
val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val map : f:('a -> 'b) -> 'b t -> 'a t
(** [map f eq] is the equality function that, given objects [x] and [y],
projects [x] and [y] using [f] (e.g. using a record field) and then
compares those projections with [eq].
Example:
[map fst int] compares values of type [(int * 'a)] by their
first component. *)
module Infix : sig
val (>|=) : 'b t -> ('a -> 'b) -> 'a t
(** Infix equivalent of {!map}. *)
end
include module type of Infix

View file

@ -10,6 +10,7 @@ module Array_sliceLabels = CCArray_sliceLabels
module Bool = CCBool module Bool = CCBool
module Char = Char module Char = Char
module Equal = CCEqual module Equal = CCEqual
module EqualLabels = CCEqualLabels
module Float = CCFloat module Float = CCFloat
module Format = CCFormat module Format = CCFormat
module Fun = CCFun module Fun = CCFun

View file

@ -10,6 +10,12 @@
(mode promote) (mode promote)
(action (run ../unlabel.exe %{deps} %{targets}))) (action (run ../unlabel.exe %{deps} %{targets})))
(rule
(targets CCEqual.mli)
(deps CCEqualLabels.mli)
(mode promote)
(action (run ../unlabel.exe %{deps} %{targets})))
(rule (rule
(targets CCList.mli) (targets CCList.mli)
(deps CCListLabels.mli) (deps CCListLabels.mli)