mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
feat(ord): add poly, deprecate compare
This commit is contained in:
parent
c10ae8d84f
commit
78a530ccee
1 changed files with 12 additions and 2 deletions
|
|
@ -6,11 +6,21 @@
|
||||||
type 'a t = 'a -> 'a -> int
|
type 'a t = 'a -> 'a -> int
|
||||||
(** Comparison (total ordering) between two elements, that returns an int. *)
|
(** Comparison (total ordering) between two elements, that returns an int. *)
|
||||||
|
|
||||||
|
val poly : 'a t
|
||||||
|
(** Polymorphic "magic" comparison. Use with care, as it will fail on
|
||||||
|
some types.
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val compare : 'a t
|
val compare : 'a t
|
||||||
(** Polymorphic "magic" comparison. *)
|
[@@deprecated "use CCOrd.poly instead, this name is too general"]
|
||||||
|
(** Polymorphic "magic" comparison.
|
||||||
|
@deprecated since NEXT_RELEASE in favor of {!poly}. The reason is that
|
||||||
|
[compare] is easily shadowed, can shadow other comparators, and is just
|
||||||
|
generally not very descriptive. *)
|
||||||
|
|
||||||
val opp : 'a t -> 'a t
|
val opp : 'a t -> 'a t
|
||||||
(** Opposite order. *)
|
(** Opposite order. For example, [opp a b < 0] iff [opp b a > 0].
|
||||||
|
This can be used to sort values in the opposite order, among other things. *)
|
||||||
|
|
||||||
val equiv : int -> int -> bool
|
val equiv : int -> int -> bool
|
||||||
(** Returns [true] iff the two comparison results are the same. *)
|
(** Returns [true] iff the two comparison results are the same. *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue