data-hash-0.2.0.1: Combinators for building fast hashing functions.

LicenseBSD-style
Maintainerjcpetruzza@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Data.Hash

Contents

Description

Combinators for building fast hashing functions.

Based on the BuzHash algorithm by Robert Uzgalis (see, e.g. "Hashing concepts and the Java programming language" at http://www.serve.net/buz/hash.adt/java.000.html)

Synopsis

The Hash type

data Hash #

A 64-bit hash

Instances
Bounded Hash # 
Instance details

Defined in Data.Hash.Base

Eq Hash # 
Instance details

Defined in Data.Hash.Base

Methods

(==) :: Hash -> Hash -> Bool #

(/=) :: Hash -> Hash -> Bool #

Ord Hash # 
Instance details

Defined in Data.Hash.Base

Methods

compare :: Hash -> Hash -> Ordering #

(<) :: Hash -> Hash -> Bool #

(<=) :: Hash -> Hash -> Bool #

(>) :: Hash -> Hash -> Bool #

(>=) :: Hash -> Hash -> Bool #

max :: Hash -> Hash -> Hash #

min :: Hash -> Hash -> Hash #

Show Hash # 
Instance details

Defined in Data.Hash.Base

Methods

showsPrec :: Int -> Hash -> ShowS #

show :: Hash -> String #

showList :: [Hash] -> ShowS #

Basic combinators

combine :: Hash -> Hash -> Hash #

h1 `combine` h2 combines hashes h1 and h2 into a new hash.

It is used to generate hash functions for complex types. For example:

hashPair :: (Hashable a, Hashable b) => (a,b) -> Hash
hashPair (a,b) = hash a `combine` hash b

Derived combinators

hashStorable :: Storable a => a -> Hash #

Observe that, unlike the other functions in this module, hashStorable is machine-dependent (the computed hash depends on endianness, etc.).

hashFoldable :: (Foldable t, Hashable a) => t a -> Hash #

The Hashable class

class Hashable a where #

Minimal complete definition

hash

Methods

hash :: a -> Hash #

Instances
Hashable Bool # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Bool -> Hash #

Hashable Char # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Char -> Hash #

Hashable Double # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Double -> Hash #

Hashable Float # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Float -> Hash #

Hashable Int # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int -> Hash #

Hashable Int8 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int8 -> Hash #

Hashable Int16 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int16 -> Hash #

Hashable Int32 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int32 -> Hash #

Hashable Int64 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int64 -> Hash #

Hashable Integer # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Integer -> Hash #

Hashable Word # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word -> Hash #

Hashable Word8 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word8 -> Hash #

Hashable Word16 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word16 -> Hash #

Hashable Word32 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word32 -> Hash #

Hashable Word64 # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word64 -> Hash #

Hashable () # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: () -> Hash #

Hashable a => Hashable [a] # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: [a] -> Hash #

Hashable a => Hashable (Maybe a) # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Maybe a -> Hash #

(Integral a, Hashable a) => Hashable (Ratio a) # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Ratio a -> Hash #

(Hashable a, Hashable b) => Hashable (Either a b) # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Either a b -> Hash #

(Hashable a, Hashable b) => Hashable (a, b) # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: (a, b) -> Hash #

(Hashable a, Hashable b, Hashable c) => Hashable (a, b, c) # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: (a, b, c) -> Hash #

(Hashable a, Hashable b, Hashable c, Hashable d) => Hashable (a, b, c, d) # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: (a, b, c, d) -> Hash #

Rolling hashes