summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/bytes.ml1
-rw-r--r--stdlib/bytes.mli3
-rw-r--r--stdlib/char.ml1
-rw-r--r--stdlib/char.mli4
-rw-r--r--stdlib/digest.ml1
-rw-r--r--stdlib/digest.mli4
-rw-r--r--stdlib/int32.ml1
-rw-r--r--stdlib/int32.mli4
-rw-r--r--stdlib/int64.ml1
-rw-r--r--stdlib/int64.mli4
-rw-r--r--stdlib/nativeint.ml1
-rw-r--r--stdlib/nativeint.mli4
-rw-r--r--stdlib/string.ml1
-rw-r--r--stdlib/string.mli4
14 files changed, 34 insertions, 0 deletions
diff --git a/stdlib/bytes.ml b/stdlib/bytes.ml
index ce6e126db..4170ad02e 100644
--- a/stdlib/bytes.ml
+++ b/stdlib/bytes.ml
@@ -260,3 +260,4 @@ let rcontains_from s i c =
type t = bytes
let compare (x: t) (y: t) = Pervasives.compare x y
+external equal : t -> t -> bool = "caml_string_equal"
diff --git a/stdlib/bytes.mli b/stdlib/bytes.mli
index 82b28a28c..e873463a1 100644
--- a/stdlib/bytes.mli
+++ b/stdlib/bytes.mli
@@ -255,6 +255,9 @@ val compare: t -> t -> int
this function [compare] allows the module [Bytes] to be passed as
argument to the functors {!Set.Make} and {!Map.Make}. *)
+val equal: t -> t -> bool
+(** The equality function for byte sequences.
+ @since 4.03.0 *)
(** {4 Unsafe conversions (for advanced users)}
diff --git a/stdlib/char.ml b/stdlib/char.ml
index 15c463542..1ba5bf6ff 100644
--- a/stdlib/char.ml
+++ b/stdlib/char.ml
@@ -65,3 +65,4 @@ let uppercase c =
type t = char
let compare c1 c2 = code c1 - code c2
+let equal (c1: t) (c2: t) = compare c1 c2 = 0
diff --git a/stdlib/char.mli b/stdlib/char.mli
index d1baa64d3..0ff4efb08 100644
--- a/stdlib/char.mli
+++ b/stdlib/char.mli
@@ -41,6 +41,10 @@ val compare: t -> t -> int
allows the module [Char] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)
+val equal: t -> t -> bool
+(** The equal function for chars.
+ @since 4.03.0 *)
+
(**/**)
(* The following is for system use only. Do not call directly. *)
diff --git a/stdlib/digest.ml b/stdlib/digest.ml
index 14cb4ebd9..4261564ff 100644
--- a/stdlib/digest.ml
+++ b/stdlib/digest.ml
@@ -16,6 +16,7 @@
type t = string
let compare = String.compare
+let equal = String.equal
external unsafe_string: string -> int -> int -> t = "caml_md5_string"
external channel: in_channel -> int -> t = "caml_md5_chan"
diff --git a/stdlib/digest.mli b/stdlib/digest.mli
index 9227cd7de..29e5b3973 100644
--- a/stdlib/digest.mli
+++ b/stdlib/digest.mli
@@ -33,6 +33,10 @@ val compare : t -> t -> int
argument to the functors {!Set.Make} and {!Map.Make}.
@since 4.00.0 *)
+val equal : t -> t -> bool
+(** The equal function for 16-character digest.
+ @since 4.03.0 *)
+
val string : string -> t
(** Return the digest of the given string. *)
diff --git a/stdlib/int32.ml b/stdlib/int32.ml
index e8e55ddc8..63c99e3d4 100644
--- a/stdlib/int32.ml
+++ b/stdlib/int32.ml
@@ -50,3 +50,4 @@ external of_string : string -> int32 = "caml_int32_of_string"
type t = int32
let compare (x: t) (y: t) = Pervasives.compare x y
+let equal (x: t) (y: t) = compare x y = 0
diff --git a/stdlib/int32.mli b/stdlib/int32.mli
index fcd300a2d..4a29e6c0f 100644
--- a/stdlib/int32.mli
+++ b/stdlib/int32.mli
@@ -153,6 +153,10 @@ val compare: t -> t -> int
allows the module [Int32] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)
+val equal: t -> t -> bool
+(** The equal function for int32s.
+ @since 4.03.0 *)
+
(**/**)
(** {6 Deprecated functions} *)
diff --git a/stdlib/int64.ml b/stdlib/int64.ml
index aa4add5f1..274a9868d 100644
--- a/stdlib/int64.ml
+++ b/stdlib/int64.ml
@@ -55,3 +55,4 @@ external float_of_bits : int64 -> float = "caml_int64_float_of_bits"
type t = int64
let compare (x: t) (y: t) = Pervasives.compare x y
+let equal (x: t) (y: t) = compare x y = 0
diff --git a/stdlib/int64.mli b/stdlib/int64.mli
index 09b476f15..edd600c69 100644
--- a/stdlib/int64.mli
+++ b/stdlib/int64.mli
@@ -175,6 +175,10 @@ val compare: t -> t -> int
allows the module [Int64] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)
+val equal: t -> t -> bool
+(** The equal function for int64s.
+ @since 4.03.0 *)
+
(**/**)
(** {6 Deprecated functions} *)
diff --git a/stdlib/nativeint.ml b/stdlib/nativeint.ml
index 94c4b9490..7412bca04 100644
--- a/stdlib/nativeint.ml
+++ b/stdlib/nativeint.ml
@@ -51,3 +51,4 @@ external of_string: string -> nativeint = "caml_nativeint_of_string"
type t = nativeint
let compare (x: t) (y: t) = Pervasives.compare x y
+let equal (x: t) (y: t) = compare x y = 0
diff --git a/stdlib/nativeint.mli b/stdlib/nativeint.mli
index 3dce1b6c4..ffa57030c 100644
--- a/stdlib/nativeint.mli
+++ b/stdlib/nativeint.mli
@@ -171,6 +171,10 @@ val compare: t -> t -> int
allows the module [Nativeint] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)
+val equal: t -> t -> bool
+(** The equal function for natives ints.
+ @since 4.03.0 *)
+
(**/**)
(** {6 Deprecated functions} *)
diff --git a/stdlib/string.ml b/stdlib/string.ml
index 93880af26..8b2dde65d 100644
--- a/stdlib/string.ml
+++ b/stdlib/string.ml
@@ -124,3 +124,4 @@ let uncapitalize s =
type t = string
let compare (x: t) (y: t) = Pervasives.compare x y
+external equal : string -> string -> bool = "caml_string_equal"
diff --git a/stdlib/string.mli b/stdlib/string.mli
index 56065bbfb..e063e6bdb 100644
--- a/stdlib/string.mli
+++ b/stdlib/string.mli
@@ -239,6 +239,10 @@ val compare: t -> t -> int
allows the module [String] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *)
+val equal: t -> t -> bool
+(** The equal function for strings.
+ @since 4.03.0 *)
+
(**/**)
(* The following is for system use only. Do not call directly. *)