Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
* Replace deprecated `sizeofMutableByteArray` with
  `getSizeofMutableByteArray` (API change).
* Remove use of `List.head` which generates a warning with later
  GHC versions. Completely un-needed anyway if `QuickCheck.sample'`
  is replaced with `QuickCheck.generate`.
  • Loading branch information
erikd committed Nov 19, 2024
1 parent a6d4fc4 commit 867febc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Data/HashTable/Internal/IntArray.hs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ writeArray (IA a) idx val = do


------------------------------------------------------------------------------
length :: IntArray s -> Int
length (IA a) = A.sizeofMutableByteArray a `div` wordSizeInBytes
length :: IntArray s -> ST s Int
length (IA a) = (`div` wordSizeInBytes) <$> A.getSizeofMutableByteArray a


------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions test/suite/Data/HashTable/Test/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Data.HashTable.Test.Common
import Control.Applicative (pure, (<$>))
#endif
import Control.Applicative ((<|>))
import Control.Monad (foldM_, liftM, when)
import Control.Monad (foldM_, when)
import qualified Control.Monad as Monad
import Data.IORef
import Data.List hiding (delete, insert,
Expand All @@ -32,7 +32,7 @@ import Test.Framework.Providers.QuickCheck2
import Test.HUnit (assertEqual,
assertFailure)
import Test.QuickCheck (arbitrary, choose,
sample')
generate)
import Test.QuickCheck.Monadic (PropertyM, assert,
forAllM, monadicIO, pre,
run)
Expand Down Expand Up @@ -242,7 +242,7 @@ testGrowTable prefix dummyArg =
prop n = do
announceQ "growTable" n
ht <- run $ go n
i <- liftM head $ run $ sample' $ choose (0,n-1)
i <- run $ generate $ choose (0,n-1)

v <- run $ lookup ht i
assertEq ("lookup " ++ show i) (Just i) v
Expand Down Expand Up @@ -290,7 +290,7 @@ testDelete prefix dummyArg =

ht <- run $ go n

i <- liftM head $ run $ sample' $ choose (4,n-1)
i <- run $ generate $ choose (4,n-1)
v <- run $ lookup ht i
assertEq ("lookup " ++ show i) (Just i) v

Expand Down

0 comments on commit 867febc

Please sign in to comment.