Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Small doc and default tweak

  • Loading branch information...
commit a95892858a5fb4cb86b7dd848aaf9ab7b5563596 1 parent 9678dae
Bryan O'Sullivan authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 Data/Hashable.hs
11 Data/Hashable.hs
View
@@ -121,7 +121,7 @@ defaultSalt :: Int
#ifdef FIXED_SALT
-defaultSalt = 2166136261
+defaultSalt = 0xdc36d1615b7400a4
{-# INLINE defaultSalt #-}
#else
@@ -135,13 +135,18 @@ defaultSalt = unsafePerformIO . alloca $ \p -> do
-- | The class of types that can be converted to a hash value.
--
--- Minimal implementation: 'hash' or 'hashWithSalt'.
+-- Minimal implementation: 'hashWithSalt' (preferred) or
+-- 'hash'.
+--
+-- When writing an instance, it is better to implement 'hashWithSalt'
+-- than 'hash', as 'hashWithSalt' can more efficiently (and perhaps
+-- more thoroughly) \"mix\" the provided salt into the resulting hash.
class Hashable a where
-- | Return a hash value for the argument.
--
-- The general contract of 'hash' is:
--
- -- * This integer need not remain consistent from one execution
+ -- * The result need not remain consistent from one execution
-- of an application to another execution of the same
-- application.
--
Please sign in to comment.
Something went wrong with that request. Please try again.