-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Combinators for building fast hashing functions. -- -- Combinators for building fast hashing functions. Includes hashing -- functions for all basic Haskell98 types. @package data-hash @version 0.2.0.0 -- | Efficient implementation of a rolling hash, i.e., the computation of a -- hash through a moving window of a fixed size n over some -- stream. All operations are O(1) (in particular, they do not depend on -- the size of the window). -- -- Some laws that this type satisfies: -- -- module Data.Hash.Rolling data RollingHash a -- | rollingHash n creates a RollingHash of window size -- n (for n > 0) rollingHash :: Int -> RollingHash a -- | addAndRoll x rh adds a new input element and rolls the window -- one place through the input (if at least n elements were -- already consumed). addAndRoll :: Hashable a => RollingHash a -> a -> RollingHash a currentHash :: RollingHash a -> Hash -- | lastHashes rh returns the last n hashes. lastHashes :: RollingHash a -> [Hash] windowSize :: RollingHash a -> Int instance Show (RollingHash a) -- | 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) module Data.Hash -- | A 64-bit hash data Hash asWord64 :: Hash -> Word64 hashWord8 :: Word8 -> 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
--   
combine :: Hash -> Hash -> Hash hashWord16 :: Word16 -> Hash hashWord32 :: Word32 -> Hash hashWord64 :: Word64 -> Hash hashInt :: Int -> Hash -- | Observe that, unlike the other functions in this module, -- hashStorable is machine-dependent (the computed hash depends -- on endianness, etc.). hashStorable :: Storable a => a -> Hash hashFoldable :: (Foldable t, Hashable a) => t a -> Hash class Hashable a hash :: Hashable a => a -> Hash