nothunks 0.1.2 → 0.1.3
raw patch · 4 files changed
+61/−16 lines, 4 filesdep ~basedep ~tastydep ~tasty-hedgehogPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, tasty, tasty-hedgehog, text, time, vector
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−1
- nothunks.cabal +24/−8
- src/NoThunks/Class.hs +26/−4
- test/Test/NoThunks/Class.hs +3/−3
CHANGELOG.md view
@@ -1,6 +1,13 @@ # Revision history for nothunks -## 0.1.2+## 0.1.3 -- 2021-06-28++* Fix tests on ghc-9.0.1+ Joe Hermaszewski <git@monoid.al>+* Make bytestring, text and vector optional dependencies+ Bodigrim <andrew.lelechenko@gmail.com>++## 0.1.2 -- 2020-12-03 * Add IORef, MVar and TVar instances. Oleg Grenrus <oleg.grenrus@iki.fi>
nothunks.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: nothunks-version: 0.1.2+version: 0.1.3 synopsis: Examine values for unexpected thunks description: Long lived application data typically should not contain any thunks. This library can be used to examine values for@@ -12,7 +12,7 @@ bug-reports: https://github.com/input-output-hk/nothunks author: IOHK maintainer: operations@iohk.io-copyright: 2018-2020 IOHK+copyright: 2018-2021 IOHK category: Development extra-source-files: CHANGELOG.md @@ -20,20 +20,36 @@ type: git location: https://github.com/input-output-hk/nothunks +flag bytestring+ description: Provide instances for bytestring+ default: True++flag text+ description: Provide instances for text+ default: True++flag vector+ description: Provide instances for vector+ default: True+ library exposed-modules: NoThunks.Class build-depends: base >= 4.12 && < 5- , bytestring >= 0.10 && < 0.11 , containers >= 0.5 && < 0.7 , stm >= 2.5 && < 2.6- , text >= 1.2 && < 1.3- , time >= 1.5 && < 1.11- , vector >= 0.12 && < 0.13+ , time >= 1.5 && < 1.13 -- Whatever is bundled with ghc , ghc-heap + if flag(bytestring)+ build-depends: bytestring >= 0.10 && < 0.12+ if flag(text)+ build-depends: text >= 1.2 && < 1.3+ if flag(vector)+ build-depends: vector >= 0.12 && < 0.13+ hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall@@ -58,8 +74,8 @@ -- Additional dependencies , hedgehog >= 1.0 && < 1.1 , random >= 1.1 && < 1.3- , tasty >= 1.3 && < 1.4- , tasty-hedgehog >= 1.0 && < 1.1+ , tasty >= 1.3 && < 1.5+ , tasty-hedgehog >= 1.0 && < 1.2 hs-source-dirs: test default-language: Haskell2010
src/NoThunks/Class.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE DerivingVia #-}@@ -45,7 +46,6 @@ -- For instances -import Data.ByteString.Short (ShortByteString) import Data.Foldable (toList) import Data.Int import Data.IntMap (IntMap)@@ -62,18 +62,28 @@ import qualified Control.Concurrent.MVar as MVar import qualified Control.Concurrent.STM.TVar as TVar-import qualified Data.ByteString as BS.Strict-import qualified Data.ByteString.Lazy as BS.Lazy-import qualified Data.ByteString.Lazy.Internal as BS.Lazy.Internal import qualified Data.IntMap as IntMap import qualified Data.IORef as IORef import qualified Data.Map as Map import qualified Data.Set as Set++#ifdef MIN_VERSION_bytestring+import Data.ByteString.Short (ShortByteString)+import qualified Data.ByteString as BS.Strict+import qualified Data.ByteString.Lazy as BS.Lazy+import qualified Data.ByteString.Lazy.Internal as BS.Lazy.Internal+#endif++#ifdef MIN_VERSION_text import qualified Data.Text as Text.Strict import qualified Data.Text.Internal.Lazy as Text.Lazy.Internal import qualified Data.Text.Lazy as Text.Lazy+#endif++#ifdef MIN_VERSION_vector import qualified Data.Vector as Vector.Boxed import qualified Data.Vector.Unboxed as Vector.Unboxed+#endif {------------------------------------------------------------------------------- Check a value for unexpected thunks@@ -509,6 +519,8 @@ ByteString -------------------------------------------------------------------------------} +#ifdef MIN_VERSION_bytestring+ -- | Instance for string bytestrings -- -- Strict bytestrings /shouldn't/ contain any thunks, but could, due to@@ -541,12 +553,16 @@ , noThunks ctxt bs' ] +#endif+ {------------------------------------------------------------------------------- Instances for text types For consistency, we follow the same pattern as for @ByteString@. -------------------------------------------------------------------------------} +#ifdef MIN_VERSION_text+ deriving via OnlyCheckWhnfNamed "Strict.Text" Text.Strict.Text instance NoThunks Text.Strict.Text @@ -560,6 +576,8 @@ , noThunks ctxt bs' ] +#endif+ {------------------------------------------------------------------------------- Tuples -------------------------------------------------------------------------------}@@ -642,6 +660,8 @@ Vector -------------------------------------------------------------------------------} +#ifdef MIN_VERSION_vector+ instance NoThunks a => NoThunks (Vector.Boxed.Vector a) where showTypeOf _ = "Boxed.Vector" wNoThunks ctxt = noThunksInValues ctxt . Vector.Boxed.toList@@ -654,6 +674,8 @@ instance NoThunks (Vector.Unboxed.Vector a) where showTypeOf _ = "Unboxed.Vector" wNoThunks _ _ = return Nothing++#endif {------------------------------------------------------------------------------- Function types
test/Test/NoThunks/Class.hs view
@@ -577,7 +577,7 @@ checkRefNF :: Property checkRefNF = checkNFClass True $ \k -> do- ! ref <- liftIO (newRef x :: IO (ref Int))+ !ref <- liftIO (newRef x :: IO (ref Int)) k ref where x :: Int@@ -593,7 +593,7 @@ checkRefNFPure :: Property checkRefNFPure = unsafeCheckNF True $ \k -> do- ! ref <- liftIO (newRef x :: IO (ref Int))+ !ref <- liftIO (newRef x :: IO (ref Int)) k ref where x :: Int@@ -609,7 +609,7 @@ checkRefNFAtomically :: Property checkRefNFAtomically = unsafeCheckNFAtomically True $ \k -> do- ! ref <- liftIO (newRef x :: IO (ref Int))+ !ref <- liftIO (newRef x :: IO (ref Int)) k ref where x :: Int