The HASH_KEY signature

The HASH_KEY signature describes a monomorphic type with an equality test and hashing function. It is used as the argument signature for the HashSetFn and HashTableFn functors, and as a sub-structure signature in the MONO_HASH_SET and MONO_HASH_TABLE signatures.

Synopsis

signature HASH_KEY

Interface

type hash_key

val hashVal : hash_key -> word

val sameKey : (hash_key * hash_key) -> bool

Description

type hash_key

The type of key values.

val hashVal : hash_key -> word

hashVal key returns a hash value for the key.

val sameKey : (hash_key * hash_key) -> bool

sameKey (key1, key2) returns true of two hash keys are equal. Implementations of this signature should ensure that if sameKey (key1, key2), then hashVal key1 = hashVal key2.