nothunks 0.1.4 → 0.1.5
raw patch · 4 files changed
+30/−9 lines, 4 filesdep ~containersdep ~hedgehogdep ~tastyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: containers, hedgehog, tasty
API changes (from Hackage documentation)
- NoThunks.Class: instance NoThunks.Class.GWRecordField f (NoThunks.Class.Elem fieldName a) => NoThunks.Class.GWNoThunks a (GHC.Generics.S1 ('GHC.Generics.MetaSel ('GHC.Maybe.Just fieldName) su ss ds) f)
+ NoThunks.Class: instance (NoThunks.Class.GWRecordField f (NoThunks.Class.Elem fieldName a), GHC.TypeLits.KnownSymbol fieldName) => NoThunks.Class.GWNoThunks a (GHC.Generics.S1 ('GHC.Generics.MetaSel ('GHC.Maybe.Just fieldName) su ss ds) f)
+ NoThunks.Class: instance NoThunks.Class.NoThunks GHC.Conc.Sync.ThreadId
+ NoThunks.Class: instance NoThunks.Class.NoThunks a => NoThunks.Class.NoThunks (Data.Functor.Identity.Identity a)
Files
- CHANGELOG.md +10/−0
- nothunks.cabal +5/−5
- src/NoThunks/Class.hs +9/−2
- test/Test/NoThunks/Class.hs +6/−2
CHANGELOG.md view
@@ -1,5 +1,15 @@ # Revision history for nothunks +## next version++## 0.1.5 -- 2023-10-29++* `NoThunks ThreadId` instance.+* `NoThunks Identity` instance+* Fix tests on ghc 9.8.+ Andreas Abel <andreas.abel@gu.se>+* Tested with ghc 8.10 to 9.8.+ ## 0.1.4 -- 2023-03-27 * Made cabal flags manual.
nothunks.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: nothunks-version: 0.1.4+version: 0.1.5 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@@ -49,9 +49,9 @@ , ghc-heap if flag(bytestring)- build-depends: bytestring >= 0.10 && < 0.12+ build-depends: bytestring >= 0.10 && < 0.13 if flag(text)- build-depends: text >= 1.2 && < 1.3 || >= 2 && < 2.1+ build-depends: text >= 1.2 && < 1.3 || >= 2 && < 2.2 if flag(vector) build-depends: vector >= 0.12 && < 0.14 @@ -77,9 +77,9 @@ , ghc-prim -- Additional dependencies- , hedgehog >= 1.1 && < 1.3+ , hedgehog >= 1.1 && < 1.5 , random >= 1.1 && < 1.3- , tasty >= 1.3 && < 1.5+ , tasty >= 1.3 && < 1.6 , tasty-hedgehog >= 1.1 && < 1.5 hs-source-dirs: test
src/NoThunks/Class.hs view
@@ -43,10 +43,12 @@ import GHC.Generics import GHC.Records import GHC.TypeLits+import GHC.Conc.Sync (ThreadId (..)) -- For instances import Data.Foldable (toList)+import Data.Functor.Identity (Identity) import Data.Int import Data.IntMap (IntMap) import Data.Kind (Type)@@ -427,10 +429,12 @@ -------------------------------------------------------------------------------} -- | If @fieldName@ is allowed to contain thunks, skip it.-instance GWRecordField f (Elem fieldName a)+instance ( GWRecordField f (Elem fieldName a)+ , KnownSymbol fieldName+ ) => GWNoThunks a (S1 ('MetaSel ('Just fieldName) su ss ds) f) where gwNoThunks _ ctxt (M1 fp) =- gwRecordField (Proxy @(Elem fieldName a)) ctxt fp+ gwRecordField (Proxy @(Elem fieldName a)) (symbolVal @fieldName Proxy : ctxt) fp class GWRecordField f (b :: Bool) where gwRecordField :: proxy b -> Context -> f x -> IO (Maybe ThunkInfo)@@ -635,10 +639,13 @@ instance NoThunks () instance NoThunks a => NoThunks [a]+instance NoThunks a => NoThunks (Identity a) instance NoThunks a => NoThunks (Maybe a) instance NoThunks a => NoThunks (NonEmpty a) instance (NoThunks a, NoThunks b) => NoThunks (Either a b)++deriving via InspectHeap ThreadId instance NoThunks ThreadId {------------------------------------------------------------------------------- Spine-strict container types
test/Test/NoThunks/Class.hs view
@@ -213,7 +213,11 @@ PairThunk _ -> NotWHNF ctxt' PairDefined a b -> constrNF [modelIsNF ctxt' a, modelIsNF ctxt' b] where+#if MIN_VERSION_GLASGOW_HASKELL(9,8,0,0)+ ctxt' = "Tuple2" : ctxt+#else ctxt' = "(,)" : ctxt+#endif fromModel (PairThunk p) k = fromModel p $ \p' -> k (if ack 3 3 > 0 then p' else p') fromModel (PairDefined a b) k = fromModel a $ \a' ->@@ -333,13 +337,13 @@ modelIsNF ctxt = \case RecordThunk _ -> NotWHNF ctxt'- RecordDefined a b -> constrNF [modelIsNF ctxt' a, modelIsNF ctxt' b]+ RecordDefined a b -> constrNF [modelIsNF ("field1" : ctxt') a, modelIsNF ("field2" : ctxt') b] where ctxt' = "Record" : ctxt modelUnexpected ctxt = \case RecordThunk _ -> Just ctxt'- RecordDefined _ y -> modelUnexpected ctxt' y+ RecordDefined _ y -> modelUnexpected ("field2" : ctxt') y where ctxt' = "Record" : ctxt