packages feed

hashable 1.1.2.1 → 1.1.2.2

raw patch · 4 files changed

+47/−4 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.Hashable: class Hashable a
+ Data.Hashable: class Hashable a where hash = hashWithSalt defaultSalt hashWithSalt salt x = salt `combine` hash x

Files

Data/Hashable.hs view
@@ -52,14 +52,23 @@ import qualified Data.Text.Array as TA import qualified Data.Text.Internal as T import qualified Data.Text.Lazy as LT-import Foreign.C (CLong, CString)+import Foreign.C (CString)+#if __GLASGOW_HASKELL__ >= 703+import Foreign.C (CLong(..))+#else+import Foreign.C (CLong)+#endif import Foreign.Marshal.Utils (with) import Foreign.Ptr (Ptr, castPtr) import Foreign.Storable (alignment, peek, sizeOf) import System.IO.Unsafe (unsafePerformIO)  #if defined(__GLASGOW_HASKELL__)+# if __GLASGOW_HASKELL__ >= 703+import Foreign.C.Types (CInt(..))+# else import Foreign.C.Types (CInt)+# endif import GHC.Base (ByteArray#) import GHC.Conc (ThreadId(..)) import GHC.Prim (ThreadId#)
cbits/hashByteString.c view
@@ -1,3 +1,36 @@+/*+Copyright Johan Tibell 2011++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Johan Tibell nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+*/+ /* Bernstein's hash */ long djb_hash(const unsigned char* str, long len, long hash) { 
hashable.cabal view
@@ -1,5 +1,5 @@ Name:                hashable-Version:             1.1.2.1+Version:             1.1.2.2 Synopsis:            A class for types that can be converted to a hash value Description:         This package defines a class, 'Hashable', for types that                      can be converted to a hash value.  This class@@ -47,7 +47,7 @@                      random == 1.0.*,                      text >= 0.11.0.5 -  Ghc-options:       -Wall+  Ghc-options:       -Wall -fno-warn-orphans  source-repository head   type:     git
tests/Properties.hs view
@@ -9,7 +9,7 @@ import Data.Hashable (Hashable(hash), hashByteArray, hashPtr) import qualified Data.Text as T import qualified Data.Text.Lazy as L-import Foreign (unsafePerformIO)+import System.IO.Unsafe (unsafePerformIO) import Foreign.Marshal.Array (withArray) import GHC.Base (ByteArray#, Int(..), newByteArray#, unsafeCoerce#,                  writeWord8Array#)@@ -68,6 +68,7 @@     go t _ | T.null t = []     go t (c:cs)       = a : go b cs       where (a,b)     = T.splitAt (unCS c) t+    go _ []           = error "Properties.rechunk - The 'impossible' happened!"  -- This wrapper is required by 'runST'. data ByteArray = BA { unBA :: ByteArray# }