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 Source #

A 64-bit hash

Instances
Bounded Hash Source # 
Instance details

Defined in Data.Hash.Base

Eq Hash Source # 
Instance details

Defined in Data.Hash.Base

Methods

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

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

Ord Hash Source # 
Instance details

Defined in Data.Hash.Base

Show Hash Source # 
Instance details

Defined in Data.Hash.Base

Basic combinators

combine :: Hash -> Hash -> Hash Source #

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 Source #

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

The Hashable class

class Hashable a where Source #

Methods

hash :: a -> Hash Source #

Instances
Hashable Bool Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Bool -> Hash Source #

Hashable Char Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Char -> Hash Source #

Hashable Double Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Double -> Hash Source #

Hashable Float Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Float -> Hash Source #

Hashable Int Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int -> Hash Source #

Hashable Int8 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int8 -> Hash Source #

Hashable Int16 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int16 -> Hash Source #

Hashable Int32 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int32 -> Hash Source #

Hashable Int64 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Int64 -> Hash Source #

Hashable Integer Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Integer -> Hash Source #

Hashable Word Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word -> Hash Source #

Hashable Word8 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word8 -> Hash Source #

Hashable Word16 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word16 -> Hash Source #

Hashable Word32 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word32 -> Hash Source #

Hashable Word64 Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: Word64 -> Hash Source #

Hashable () Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: () -> Hash Source #

Hashable a => Hashable [a] Source # 
Instance details

Defined in Data.Hash.Instances

Methods

hash :: [a] -> Hash Source #

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

Defined in Data.Hash.Instances

Methods

hash :: Maybe a -> Hash Source #

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

Defined in Data.Hash.Instances

Methods

hash :: Ratio a -> Hash Source #

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

Defined in Data.Hash.Instances

Methods

hash :: Either a b -> Hash Source #

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

Defined in Data.Hash.Instances

Methods

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

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

Defined in Data.Hash.Instances

Methods

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

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

Defined in Data.Hash.Instances

Methods

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

Rolling hashes