The HASH_KEY signature
Author: John Reppy
Keywords: Standard ML, SML, SML/NJ Library

The SML of NJ Library
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`.

## See Also

`HashSetFn`, `HashTableFn`, `MONO_HASH_TABLE`, The Util Library

SML/NJ Version 110.99.9 (November 4, 2025)
Last updated 2025-11-04 15:48:25 UTC