large-hashable-0.1.0.0: Efficiently hash (large) Haskell values

Safe HaskellNone
LanguageHaskell2010

Data.LargeHashable.Intern

Description

Generic, low-level data types for hashing. This is an internal module.

You should only import this module if you write your own hash algorithm or if you need access to low-level hashing functions when defining instances of LargeHash.

Regular users should not import this module. Import LargeHashable instead.

Synopsis

Documentation

data HashUpdates Source

Functions for updating an intermediate hash value. The functions live in the IO monad because they are typically implemented via FFI.

Constructors

HashUpdates 

Fields

hu_updatePtr :: !(Ptr Word8 -> Int -> IO ())

adds a byte array to the hash

hu_updateChar :: !(CChar -> IO ())
 
hu_updateUChar :: !(CUChar -> IO ())
 
hu_updateShort :: !(CShort -> IO ())
 
hu_updateUShort :: !(CUShort -> IO ())
 
hu_updateInt :: !(CInt -> IO ())
 
hu_updateUInt :: !(CUInt -> IO ())
 
hu_updateLong :: !(CLong -> IO ())
 
hu_updateULong :: !(CULong -> IO ())
 

data HashAlgorithm h Source

The interface for a hashing algorithm. The interface contains a simple run function, which is used to update the hash with all values needed, and the outputs the resulting hash.

Constructors

HashAlgorithm 

Fields

ha_run :: !((HashUpdates -> IO ()) -> IO h)
 
ha_xor :: !(h -> h -> h)
 
ha_updateHash :: !(HashUpdates -> h -> IO ())
 

data LH a Source

The LH monad (LH stands for "large hash") is used in the definition of hashing functions for arbitrary data types.

ioInLH :: IO a -> LH a Source

Perform an IO action in the LH monad. Use with care, do not perform arbitrary IO operation with this function! Only use it for calling functions of the HashUpdates datatype.

runLH :: HashAlgorithm h -> LH () -> h Source

Runs a LH computation and returns the resulting hash.

updateXorHash :: [LH ()] -> LH () Source