Edison-1.2ContentsIndex
Data.Edison.Prelude
PortabilityGHC, Hugs (MPTC and FD)
Stabilitystable
Maintainerrobdockins AT fastmail DOT fm
Contents
Hashing classes
Description
This module is a central depository of common definitions used throughout Edison.
Synopsis
class Eq a => Hash a where
hash :: a -> Int
class Hash a => UniqueHash a
class UniqueHash a => ReversibleHash a where
unhash :: Int -> a
Hashing classes
class Eq a => Hash a where

This class represents hashable objects. If obeys the following invariant:

forall x,y :: a. (x == y) implies (hash x == hash y)
Methods
hash :: a -> Int
class Hash a => UniqueHash a

This class represents hashable objects where the hash function is unique (injective). There are no new methods, just a stronger invariant:

forall x,y :: a. (x == y) iff (hash x == hash y)
class UniqueHash a => ReversibleHash a where

This class represents hashable objects where the hash is reversible.

forall x :: a. unhash (hash x) == x

Note that:

hash (unhash i) == i

does not necessarily hold because unhash is not necessarily defined for all i, only for all i in the range of hash.

Methods
unhash :: Int -> a
Produced by Haddock version 0.8