HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduledata-hash-0.2.0.1Haskell98

Data.Hash

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)

  • 1 type
  • 1 class
  • 9 values

The Hash type

2 declarations
newtypenewtype Hash
#

A 64-bit hash

Instances4Bounded, Eq, Ord, Show
  • Bounded HashDefined in data-hash-0.2.0.1 · Data.Hash.Base
  • Eq HashDefined in data-hash-0.2.0.1 · Data.Hash.Base
  • Ord HashDefined in data-hash-0.2.0.1 · Data.Hash.Base
  • Show HashDefined in data-hash-0.2.0.1 · Data.Hash.Base

Basic combinators

valuecombine :: 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

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

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

The Hashable class

1 declaration
classclass Hashable a where
#

Methods

Instances23Hashable, …

Rolling hashes

0 declarations