hashmap-1.0.0: Persistent containers HashMap and HashSet.

Portabilityportable
Stabilityprovisional
Maintainerfox@ucw.cz

Data.Hashable

Description

Hashable class for hashable types, with instances for basic types. The only function of this class is

   hash :: Hashable h => h -> Int

The hash function should be as collision-free as possible, the probability of hash a == hash b should ideally be 1 over the number of representable values in an Int.

Returning an Int is a result of the Data.IntMap.IntMap using Int as a key, as inserting the hash values to the Data.IntMap.IntMap was the purpose of creating this class.

Synopsis

Documentation

class Hashable a whereSource

The class containing a function hash which computes the hash values of given value.

Methods

hash :: a -> IntSource

The computed hash value should be as collision-free as possible, the probability of hash a == hash b should ideally be 1 over the number of representable values in an Int.

Instances

Hashable Bool 
Hashable Char 
Hashable Int 
Hashable Int8 
Hashable Int16 
Hashable Int32 
Hashable Int64 
Hashable Word 
Hashable Word8 
Hashable Word16 
Hashable Word32 
Hashable Word64 
Hashable () 
Hashable ByteString 
Hashable ByteString 
Hashable a => Hashable [a] 
Hashable a => Hashable (Maybe a) 
(Hashable a1, Hashable a2) => Hashable (a1, a2) 
(Hashable a1, Hashable a2, Hashable a3) => Hashable (a1, a2, a3) 
(Hashable a1, Hashable a2, Hashable a3, Hashable a4) => Hashable (a1, a2, a3, a4) 
(Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5) => Hashable (a1, a2, a3, a4, a5) 
(Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5, Hashable a6) => Hashable (a1, a2, a3, a4, a5, a6) 
(Hashable a1, Hashable a2, Hashable a3, Hashable a4, Hashable a5, Hashable a6, Hashable a7) => Hashable (a1, a2, a3, a4, a5, a6, a7) 

combine :: Int -> Int -> IntSource

Combines two given hash values.