From 87f35e1fd6a4ef4eaf6101a9b96e47400aa47502 Mon Sep 17 00:00:00 2001 From: Simmo Saan Date: Tue, 7 May 2024 03:16:13 +0300 Subject: [PATCH] Add Stdlib type equality to Set.Make, Map.Make and Hashtbl.Make (#1132) * Add Stdlib type equality to Set, Map and Hashtbl * Add PR #1132 to ChangeLog --- ChangeLog | 6 ++++++ src/batHashtbl.ml | 2 +- src/batHashtbl.mli | 2 +- src/batMap.mli | 2 +- src/batSet.mli | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 70178ef29..6de7cddea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ Changelog ========= +## NEXT_RELEASE + +- Add Stdlib type equality to Set.Make, Map.Make and Hashtbl.Make + #1132 + (Simmo Saan) + ## v3.8.0 (minor release) - support OCaml 5.2 diff --git a/src/batHashtbl.ml b/src/batHashtbl.ml index d0061d740..c9e463018 100644 --- a/src/batHashtbl.ml +++ b/src/batHashtbl.ml @@ -673,7 +673,7 @@ sig end -module Make(H: HashedType): (S with type key = H.t) = +module Make(H: HashedType): (S with type key = H.t and type 'a t = 'a Hashtbl.Make (H).t) = struct include Hashtbl.Make(H) external to_hash : 'a t -> (key, 'a) Hashtbl.t = "%identity" diff --git a/src/batHashtbl.mli b/src/batHashtbl.mli index 2d368983f..bde6db014 100644 --- a/src/batHashtbl.mli +++ b/src/batHashtbl.mli @@ -512,7 +512,7 @@ sig end (** The output signature of the functor {!Hashtbl.Make}. *) -module Make (H : HashedType) : S with type key = H.t +module Make (H : HashedType) : S with type key = H.t and type 'a t = 'a Hashtbl.Make (H).t (** Functor building an implementation of the hashtable structure. The functor [Hashtbl.Make] returns a structure containing a type [key] of keys and a type ['a t] of hash tables diff --git a/src/batMap.mli b/src/batMap.mli index 5f0a325fa..d709c5e85 100644 --- a/src/batMap.mli +++ b/src/batMap.mli @@ -515,7 +515,7 @@ sig end -module Make (Ord : BatInterfaces.OrderedType) : S with type key = Ord.t +module Make (Ord : BatInterfaces.OrderedType) : S with type key = Ord.t with type 'a t = 'a Map.Make (Ord).t (** Functor building an implementation of the map structure given a totally ordered type. *) diff --git a/src/batSet.mli b/src/batSet.mli index c5be93d7c..d8bf5d8f2 100644 --- a/src/batSet.mli +++ b/src/batSet.mli @@ -475,7 +475,7 @@ module IRopeSet : S with type elt = BatRope.t *) -module Make (Ord : OrderedType) : S with type elt = Ord.t +module Make (Ord : OrderedType) : S with type elt = Ord.t and type t = Set.Make (Ord).t (** Functor building an implementation of the set structure given a totally ordered type.