diff --git a/hashtables.cabal b/hashtables.cabal
--- a/hashtables.cabal
+++ b/hashtables.cabal
@@ -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
diff --git a/src/Data/HashTable/Class.hs b/src/Data/HashTable/Class.hs
--- a/src/Data/HashTable/Class.hs
+++ b/src/Data/HashTable/Class.hs
@@ -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
diff --git a/src/Data/HashTable/IO.hs b/src/Data/HashTable/IO.hs
--- a/src/Data/HashTable/IO.hs
+++ b/src/Data/HashTable/IO.hs
@@ -62,7 +62,6 @@
 
 ------------------------------------------------------------------------------
 #if !MIN_VERSION_base(4,8,0)
-import           Control.Applicative
 import           Data.Word
 #endif
 import           Control.Monad.Primitive       (PrimState)
diff --git a/src/Data/HashTable/Internal/CacheLine.hs b/src/Data/HashTable/Internal/CacheLine.hs
--- a/src/Data/HashTable/Internal/CacheLine.hs
+++ b/src/Data/HashTable/Internal/CacheLine.hs
@@ -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 ()
diff --git a/src/Data/HashTable/Internal/CheapPseudoRandomBitStream.hs b/src/Data/HashTable/Internal/CheapPseudoRandomBitStream.hs
--- a/src/Data/HashTable/Internal/CheapPseudoRandomBitStream.hs
+++ b/src/Data/HashTable/Internal/CheapPseudoRandomBitStream.hs
@@ -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
diff --git a/src/Data/HashTable/Internal/IntArray.hs b/src/Data/HashTable/Internal/IntArray.hs
--- a/src/Data/HashTable/Internal/IntArray.hs
+++ b/src/Data/HashTable/Internal/IntArray.hs
@@ -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
diff --git a/src/Data/HashTable/Internal/UnsafeTricks.hs b/src/Data/HashTable/Internal/UnsafeTricks.hs
--- a/src/Data/HashTable/Internal/UnsafeTricks.hs
+++ b/src/Data/HashTable/Internal/UnsafeTricks.hs
@@ -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
 
 
diff --git a/src/Data/HashTable/ST/Basic.hs b/src/Data/HashTable/ST/Basic.hs
--- a/src/Data/HashTable/ST/Basic.hs
+++ b/src/Data/HashTable/ST/Basic.hs
@@ -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 #-}
 
 
 ------------------------------------------------------------------------------
diff --git a/test/suite/Data/HashTable/Test/Common.hs b/test/suite/Data/HashTable/Test/Common.hs
--- a/test/suite/Data/HashTable/Test/Common.hs
+++ b/test/suite/Data/HashTable/Test/Common.hs
@@ -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
 
 
 ------------------------------------------------------------------------------
