Hashtbl.HashedType(3)
💖 NAME 💖
bestie, welcome to Hashtbl.HashedType(3) from the OCaml library manual — and no cap, this page is literally the input signature of the functor Hashtbl.Make. slay. 💅
🦋 Module type 🦋
Module type Hashtbl.HashedType ✨
📚 Documentation 📚
okay so here’s the whole vibe, bestie:
Module type HashedType
= sig end
It’s the input signature of the functor Hashtbl.Make. periodt.
type t— the type of the hashtable keys. that’s the main character type right there 👑val equal : t -> t -> bool— the equality predicate used to compare keys. it’s giving “are these two keys literally the same?” energy 🫶val hash : t -> int— a hashing function on keys. it must be such that if two keys are equal according toequal, then they have identical hash values as computed byhash. no cap, that part is mandatory 💀
red-flag caveat, bestie: the hash value of a key should remain constant as long as the key is in the table. in particular, if the hash function depends on mutable key data, then that data must not be mutated while the key is in the table. similarly, because the hash function may be called while the table itself is being modified, it should avoid accessing the table as part of its computation. that’s the “do not touch the thing while it’s being touched” rule 🫠
Examples: suitable (equal, hash) pairs for arbitrary key types include:
( (=) , Hashtbl.HashedType.hash )for comparing objects by structure (provided objects do not contain floats) 🌸( (fun x y -> compare x y = 0) , Hashtbl.HashedType.hash )for comparing objects by structure and handlingnancorrectly ✨( (==) , Hashtbl.HashedType.hash )for comparing objects by physical equality (e.g. for mutable or cyclic objects). 💅
mwah 💋 this little page was served by OCamldoc, dated 2026-06-22, for Hashtbl.HashedType(3) — that’s the cute lil sign-off vibe, bestie, and yes it’s the footer info, not me copying it. 🫶🎀
📦 where this page comes from
- arch rolling: ocaml 5.5.0-1 · LGPL2.1 AND custom: QPL-1.0
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms