| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | module type HashedType = |
| 12 | sig |
| 13 | type t |
| 14 | val compare : t -> t -> int |
| 15 | (** Total ordering *) |
| 16 | |
| 17 | val hash : t -> int |
| 18 | (** Hashing function compatible with [compare], i.e. [compare x y = 0] implies |
| 19 | [hash x = hash y]. *) |
| 20 | end |
| 21 | |
| 22 | (** Hash maps are maps that take advantage of having a hash on keys. This is |
| 23 | essentially a hash table, except that it uses purely functional maps instead |
| 24 | of arrays. |
| 25 | |
| 26 | CAVEAT: order-related functions like [fold] or [iter] do not respect the |
| 27 | provided order anymore! It's your duty to do something sensible to prevent |
| 28 | this if you need it. |
| 29 | *) |
| 30 | module Make(M : HashedType) : CMap.UExtS with type key = M.t |