From 505d6f6c7c8f18a4fa359ec964a9da58838047ca Mon Sep 17 00:00:00 2001 From: Zolisa Bleki Date: Sun, 30 Jun 2024 16:21:49 +0200 Subject: [PATCH] Ensure Hashtbl.Make works for `String` in ocaml<5.0 --- lib/storage/memory.ml | 8 +++++++- lib/util.ml | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/storage/memory.ml b/lib/storage/memory.ml index 7c7a2f6..c0be211 100644 --- a/lib/storage/memory.ml +++ b/lib/storage/memory.ml @@ -1,4 +1,10 @@ -module StrMap = Hashtbl.Make (String) +module HashableString = struct + type t = string + let hash = Hashtbl.hash + let equal = String.equal +end + +module StrMap = Hashtbl.Make (HashableString) module Impl = struct type t = string StrMap.t diff --git a/lib/util.ml b/lib/util.ml index f7232b8..29e92e0 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -9,14 +9,12 @@ type ('a, 'b) array_repr = ;fill_value : 'a} module HashableArray = struct - include Array type t = int array let hash = Hashtbl.hash let equal x y = Array.for_all2 Int.equal x y end module ComparableArray = struct - include Array type t = int array let compare = Stdlib.compare end