Skip to content

Commit

Permalink
Ensure Hashtbl.Make works for String in ocaml<5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zoj613 committed Jun 30, 2024
1 parent 222eeeb commit 505d6f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/storage/memory.ml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions lib/util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 505d6f6

Please sign in to comment.