hashtables 1.2.4.1 → 1.2.4.2
raw patch · 9 files changed
+60/−32 lines, 9 filesdep ~basePVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Data.HashTable.ST.Basic: size :: HashTable s k v -> ST s Int
Files
- hashtables.cabal +27/−3
- src/Data/HashTable/Class.hs +1/−1
- src/Data/HashTable/IO.hs +0/−1
- src/Data/HashTable/Internal/CacheLine.hs +0/−9
- src/Data/HashTable/Internal/CheapPseudoRandomBitStream.hs +2/−3
- src/Data/HashTable/Internal/IntArray.hs +16/−2
- src/Data/HashTable/Internal/UnsafeTricks.hs +0/−10
- src/Data/HashTable/ST/Basic.hs +9/−1
- test/suite/Data/HashTable/Test/Common.hs +5/−2
hashtables.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: 2.2 Name: hashtables-Version: 1.2.4.1+Version: 1.2.4.2 Synopsis: Mutable hash tables in the ST monad Homepage: http://github.com/gregorycollins/hashtables License: BSD-3-Clause@@ -12,8 +12,17 @@ Build-type: Simple -tested-with: GHC==8.8.1,GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4-+tested-with:+ GHC == 7.8.4+ GHC == 7.10.3+ GHC == 8.0.2+ GHC == 8.2.2+ GHC == 8.4.4+ GHC == 8.6.5+ GHC == 8.8.4+ GHC == 8.10.7+ GHC == 9.0.1+ GHC == 9.2.1 Description: This package provides a couple of different implementations of mutable hash@@ -217,6 +226,21 @@ hs-source-dirs: src test/suite main-is: TestSuite.hs type: exitcode-stdio-1.0++ other-modules:+ Data.HashTable.Class+ Data.HashTable.IO+ Data.HashTable.Internal.Array+ Data.HashTable.Internal.CacheLine+ Data.HashTable.Internal.CheapPseudoRandomBitStream+ Data.HashTable.Internal.IntArray+ Data.HashTable.Internal.Linear.Bucket+ Data.HashTable.Internal.UnsafeTricks+ Data.HashTable.Internal.Utils+ Data.HashTable.ST.Basic+ Data.HashTable.ST.Cuckoo+ Data.HashTable.ST.Linear+ Data.HashTable.Test.Common if flag(sse42) && !flag(portable) cc-options: -DUSE_SSE_4_2 -msse4.2
src/Data/HashTable/Class.hs view
@@ -48,10 +48,10 @@ #if !MIN_VERSION_base(4,8,0) import Control.Applicative+import Data.Word (Word) #endif import Control.Monad.ST import Data.Hashable-import Data.Word (Word) import Prelude hiding (mapM_) -- | A typeclass for hash tables in the 'ST' monad. The operations on these
src/Data/HashTable/IO.hs view
@@ -62,7 +62,6 @@ ------------------------------------------------------------------------------ #if !MIN_VERSION_base(4,8,0)-import Control.Applicative import Data.Word #endif import Control.Monad.Primitive (PrimState)
src/Data/HashTable/Internal/CacheLine.hs view
@@ -38,15 +38,6 @@ import Data.HashTable.Internal.Utils import GHC.Exts -#if __GLASGOW_HASKELL__ >= 808--- Nothing to do here.-#elif __GLASGOW_HASKELL__ >= 707-import GHC.Exts (isTrue#)-#else-isTrue# :: Bool -> Bool-isTrue# = id-#endif- {-# INLINE prefetchRead #-} {-# INLINE prefetchWrite #-} prefetchRead :: IntArray s -> Int -> ST s ()
src/Data/HashTable/Internal/CheapPseudoRandomBitStream.hs view
@@ -15,10 +15,9 @@ import Data.Vector.Unboxed (Vector) import qualified Data.Vector.Unboxed as V -#if __GLASGOW_HASKELL__ >= 808 import Data.Word (Word32, Word64)-#else-import Data.Word (Word, Word32, Word64)+#if !MIN_VERSION_base(4,8,0)+import Data.Word (Word) #endif import Data.HashTable.Internal.Utils
src/Data/HashTable/Internal/IntArray.hs view
@@ -52,7 +52,7 @@ ------------------------------------------------------------------------------ primWordToElem :: Word# -> Elem-primWordToElem = W16#+primWordToElem w# = W16# (wordToWord16Compat# w#) ------------------------------------------------------------------------------@@ -63,7 +63,7 @@ ------------------------------------------------------------------------------ elemToInt# :: Elem -> Int#-elemToInt# (W16# w#) = word2Int# w#+elemToInt# (W16# w#) = word2Int# (word16ToWordCompat# w#) ------------------------------------------------------------------------------@@ -118,4 +118,18 @@ !(Ptr !a#) = A.mutableByteArrayContents a #else !(Addr !a#) = A.mutableByteArrayContents a+#endif++#if MIN_VERSION_base(4,16,0)+word16ToWordCompat# :: Word16# -> Word#+word16ToWordCompat# = word16ToWord#++wordToWord16Compat# :: Word# -> Word16#+wordToWord16Compat# = wordToWord16#+#else+word16ToWordCompat# :: Word# -> Word#+word16ToWordCompat# x = x++wordToWord16Compat# :: Word# -> Word#+wordToWord16Compat# x = x #endif
src/Data/HashTable/Internal/UnsafeTricks.hs view
@@ -22,16 +22,6 @@ #ifdef UNSAFETRICKS import GHC.Exts import Unsafe.Coerce--#if __GLASGOW_HASKELL__ >= 808--- Nothing to do here.-#elif __GLASGOW_HASKELL__ >= 707-import GHC.Exts (isTrue#)-#else-isTrue# :: Bool -> Bool-isTrue# = id-#endif- #endif
src/Data/HashTable/ST/Basic.hs view
@@ -84,6 +84,7 @@ ( HashTable , new , newSized+ , size , delete , lookup , insert@@ -202,7 +203,6 @@ newRef ht {-# INLINE newSized #-} - ------------------------------------------------------------------------------ newSizedReal :: Int -> ST s (HashTable_ s k v) newSizedReal m = do@@ -215,6 +215,14 @@ v <- newArray m undefined ld <- newSizeRefs return $! HashTable m ld h k v++------------------------------------------------------------------------------+-- | Returns the number of mappings currently stored in this table. /O(1)/+size :: HashTable s k v -> ST s Int+size htRef = do+ HashTable _ sizeRefs _ _ _ <- readRef htRef+ readLoad sizeRefs+{-# INLINE size #-} ------------------------------------------------------------------------------
test/suite/Data/HashTable/Test/Common.hs view
@@ -11,7 +11,10 @@ ) where -------------------------------------------------------------------------------import Control.Applicative (pure, (<|>))+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative (pure, (<$>))+#endif+import Control.Applicative ((<|>)) import Control.Monad (foldM_, liftM, when) import qualified Control.Monad as Monad import Data.IORef@@ -498,7 +501,7 @@ ------------------------------------------------------------------------------ initializeRNG :: PropertyM IO GenIO-initializeRNG = run $ withSystemRandom (return :: GenIO -> IO GenIO)+initializeRNG = run createSystemRandom ------------------------------------------------------------------------------