-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A class for types that can be converted to a hash value -- -- This package defines a class, Hashable, for types that can be -- converted to a hash value. This class exists for the benefit of -- hashing-based data structures. The package provides instances for -- basic types and a way to combine hash values. @package hashable @version 1.2.0.1 -- | This module defines a class, Hashable, for types that can be -- converted to a hash value. This class exists for the benefit of -- hashing-based data structures. The module provides instances for most -- standard types. Efficient instances for other types can be generated -- automatically and effortlessly using the generics support in GHC 7.2 -- and above. -- -- The easiest way to get started is to use the hash function. -- Here is an example session with ghci. -- --
--   Prelude> import Data.Hashable
--   Prelude> hash "foo"
--   60853164
--   
module Data.Hashable -- | Return a hash value for the argument. Defined in terms of -- hashWithSalt and a default salt. -- -- At application startup time, the default salt is initialized with a -- new value from the system's cryptographic pseudo-random number -- generator. This means that the result of hash will vary from -- one application run to the next. -- -- If you need hashes that do not vary from run to run, use -- hashWithSalt instead, and supply a salt of your choosing. (Be -- aware that if you hash untrusted, uncontrolled input data using a -- fixed salt, you may expose your application to hash collision -- attacks.) hash :: Hashable a => a -> Int -- | The class of types that can be converted to a hash value. class Hashable a where hashWithSalt salt = ghashWithSalt salt . from hashWithSalt :: Hashable a => Int -> a -> Int -- | Transform a value into a Hashable value, then hash the -- transformed value using the given salt. -- -- This is a useful shorthand in cases where a type can easily be mapped -- to another type that is already an instance of Hashable. -- Example: -- --
--   data Foo = Foo | Bar
--            deriving (Enum)
--   
--   instance Hashable Foo where
--       hashWithSalt = hashUsing fromEnum
--   
hashUsing :: Hashable b => (a -> b) -> Int -> a -> Int -- | Compute a hash value for the content of this pointer. hashPtr :: Ptr a -> Int -> IO Int -- | Compute a hash value for the content of this pointer, using an initial -- salt. -- -- This function can for example be used to hash non-contiguous segments -- of memory as if they were one contiguous segment, by using the output -- of one hash as the salt for the next. hashPtrWithSalt :: Ptr a -> Int -> Int -> IO Int -- | Compute a hash value for the content of this ByteArray#, -- beginning at the specified offset, using specified number of bytes. -- Availability: GHC. hashByteArray :: ByteArray# -> Int -> Int -> Int -- | Compute a hash value for the content of this ByteArray#, using -- an initial salt. -- -- This function can for example be used to hash non-contiguous segments -- of memory as if they were one contiguous segment, by using the output -- of one hash as the salt for the next. -- -- Availability: GHC. hashByteArrayWithSalt :: ByteArray# -> Int -> Int -> Int -> Int