nothunks 0.2.1.1 → 0.3.1
raw patch · 5 files changed
Files
- CHANGELOG.md +11/−0
- NOTICE +1/−1
- nothunks.cabal +8/−8
- src/NoThunks/Class.hs +14/−11
- test/Test/NoThunks/Class.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,16 @@ # Revision history for nothunks +## 0.3.1 -- 2025-07-30++* Make it build with ghc-9.12.+* Added support for:+ * `containers-0.8`+ * `random-1.3.0`++## 0.3.0 -- 2024-08-13++* Include _both_ `Context` _and_ `Info` in `ThunkInfo` (#54)+ ## 0.2.1.0 -- 2024-02-06 * Exported `mkThunkInfo`.
NOTICE view
@@ -1,4 +1,4 @@-Copyright 2018-2024 Input Output Global Inc (IOG)+Copyright 2018-2025 Input Output Global Inc (IOG) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
nothunks.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: nothunks-version: 0.2.1.1+version: 0.3.1 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@@ -13,10 +13,10 @@ bug-reports: https://github.com/input-output-hk/nothunks author: IOG maintainer: Marcin Szamotulski <coot@coot.me>-copyright: 2018-2024 Input Output Global Inc (IOG)+copyright: 2018-2025 Input Output Global Inc (IOG) category: Development extra-doc-files: README.md CHANGELOG.md-tested-with: GHC == {8.10, 9.0, 9.2, 9.4, 9.6, 9.8, 9.10}+tested-with: GHC == {8.10, 9.0, 9.2, 9.4, 9.6, 9.8, 9.10, 9.12} source-repository head type: git@@ -41,15 +41,15 @@ exposed-modules: NoThunks.Class build-depends: base >= 4.12 && < 5- , containers >= 0.5 && < 0.8+ , containers >= 0.5 && < 0.9 , stm >= 2.5 && < 2.6- , time >= 1.5 && < 1.13+ , time >= 1.5 && < 1.15 -- Whatever is bundled with ghc , ghc-heap if impl(ghc >= 9.2)- build-depends: wherefrom-compat ^>= 0.1.1+ build-depends: wherefrom-compat ^>= 0.2 if flag(bytestring) build-depends: bytestring >= 0.10 && < 0.13@@ -80,8 +80,8 @@ , ghc-prim -- Additional dependencies- , hedgehog >= 1.1 && < 1.5- , random >= 1.1 && < 1.3+ , hedgehog >= 1.1 && < 1.6+ , random >= 1.1 && < 1.4 , tasty >= 1.3 && < 1.6 , tasty-hedgehog >= 1.1 && < 1.5
src/NoThunks/Class.hs view
@@ -133,8 +133,8 @@ -- WHNF, and if so, adds the type into the context (using 'showTypeOf' or -- 'whereFrom' if available), and calls 'wNoThunks'. See 'ThunkInfo' for -- a detailed discussion of the type context.- -- --+ -- -- See also discussion of caveats listed for 'checkContainsThunks'. noThunks :: Context -> a -> IO (Maybe ThunkInfo) noThunks ctxt x = do@@ -227,7 +227,10 @@ -- > ["Int","List","(,)"] an Int in the [Int] in the pair -- -- Note: prior to `ghc-9.6` a list was indicated by `[]`.-newtype ThunkInfo = ThunkInfo { thunkInfo :: Either Context Info }+data ThunkInfo = ThunkInfo {+ thunkContext :: Context+ , thunkInfo :: Maybe Info+ } deriving Show -- | Construct `ThunkInfo` either from `Context` or information provided by@@ -235,7 +238,7 @@ -- mkThunkInfo :: Context -> a -> IO ThunkInfo #if MIN_VERSION_base(4,16,0)-mkThunkInfo ctxt a = ThunkInfo . maybe (Left ctxt) (Right . fmt) <$> whereFrom a+mkThunkInfo ctxt a = ThunkInfo ctxt . fmap fmt <$> whereFrom a where fmt :: InfoProv -> Info fmt InfoProv { ipSrcFile, ipSrcSpan,@@ -243,7 +246,7 @@ ipLabel ++ " :: " ++ ipTyDesc ++ " @ " ++ ipSrcFile ++ ":" ++ ipSrcSpan #else-mkThunkInfo ctxt _ = return (ThunkInfo (Left ctxt))+mkThunkInfo ctxt _ = return (ThunkInfo ctxt Nothing) #endif @@ -527,18 +530,18 @@ deriving via Bool instance NoThunks Semigroup.All deriving via Bool instance NoThunks Semigroup.Any deriving via a instance NoThunks a => NoThunks (Semigroup.Sum a)-deriving via a instance NoThunks a => NoThunks (Semigroup.Product a) -deriving via a instance NoThunks a => NoThunks (Semigroup.WrappedMonoid a) -instance (NoThunks a, NoThunks b) => NoThunks (Semigroup.Arg a b) +deriving via a instance NoThunks a => NoThunks (Semigroup.Product a)+deriving via a instance NoThunks a => NoThunks (Semigroup.WrappedMonoid a)+instance (NoThunks a, NoThunks b) => NoThunks (Semigroup.Arg a b) {------------------------------------------------------------------------------- Monoids -------------------------------------------------------------------------------} -deriving via (Maybe a) instance NoThunks a => NoThunks (Monoid.First a) -deriving via (Maybe a) instance NoThunks a => NoThunks (Monoid.Last a) -deriving via (f a) instance NoThunks (f a) => NoThunks (Monoid.Alt f a) -deriving via (f a) instance NoThunks (f a) => NoThunks (Monoid.Ap f a) +deriving via (Maybe a) instance NoThunks a => NoThunks (Monoid.First a)+deriving via (Maybe a) instance NoThunks a => NoThunks (Monoid.Last a)+deriving via (f a) instance NoThunks (f a) => NoThunks (Monoid.Alt f a)+deriving via (f a) instance NoThunks (f a) => NoThunks (Monoid.Ap f a) {------------------------------------------------------------------------------- Solo
test/Test/NoThunks/Class.hs view
@@ -107,7 +107,7 @@ -- | Check whether the model and the implementation agree on whether the value -- is in NF, and if not, what the context of the thunk is. agreeOnContext :: Maybe ThunkInfo -> Maybe [String] -> Bool-agreeOnContext mThunk mCtxt = (thunkInfo <$> mThunk) == (Left <$> mCtxt)+agreeOnContext mThunk mCtxt = (thunkContext <$> mThunk) == mCtxt {------------------------------------------------------------------------------- Infrastructure