Module

Data.Hashable

Package
purescript-unordered-collections
Repository
fehrenbach/purescript-unordered-collections

#Hashable Source

class (Eq a) <= Hashable a  where

The Hashable type class represents types with decidable equality and a hash function for use in hash-based algorithms and data structures, not cryptography.

Instances of Hashable must satisfy the following law:

(a == b) `implies` (hash a == hash b)

Note that while hash = const 0 is a law-abiding implementation, one would usually prefer more discrimination. Hash-based data structures and algorithms tend to perform badly in the presence of excessive numbers of collisions.

Hash values produced by hash should not be relied upon to be stable accross multiple executions of a program and should not be stored externally. While we currently do not do this, we might want to use a fresh salt for every execution in the future.

Members

Instances