packages feed

stock-deepseq

Derive NFData via the stock plugin

view on Hackage

The <https://hackage.haskell.org/package/stock stock> plugin provides a newtype __@<https://hackage-content.haskell.org/package/stock-0.1.0.0/docs/Stock.html#t:Stock Stock>@__ for deriving and synthesising instances at compile time. __stock-deepseq__ extends it to support @<https://hackage-content.haskell.org/package/deepseq-1.5.2.0/docs/Control-DeepSeq.html#t:NFData NFData>@ and higher-kinded variants. > {-# options_ghc -fplugin Stock #-} > > {-# language DerivingVia #-} > {-# language DataKinds #-} > > import Stock > import Stock.NFData > > import Control.Exception > > data Person = P { name :: String, age :: Int, secret :: Person } > deriving (Eq, Ord, Show, NFData) via > Stock Person > > -- >> try @SomeException (evaluate (rnf geir)) > -- Left stack overflow > -- >> geir == geir > -- <loop> > -- >> geir > -- P {name = "Geir", age = 10, secret = P {name = "Geir", .. } } > geir :: Person > geir = P { name = "Geir", age = 10, secret = geir } The @rnf@ function triggers the loop, but by pinning @secret@ as an ignored field, we can happily force the other fields. > newtype Ignore a = Ignore a > instance NFData (Ignore a) where rnf _ = () > instance Eq (Ignore a) where _ == _ = True > instance Ord (Ignore a) where compare _ _ = EQ > instance Show (Ignore a) where show _ = "<ignored>" > > data Person = P { name :: String, age :: Int, secret :: Person } > deriving (Eq, Ord, Show, NFData) via > Overriding Person '[ secret via Ignore ] > > -- >> try @SomeException (evaluate (rnf geir)) > -- Right () > -- >> geir == geir > -- True > -- >> geir > -- P {name = "Geir", age = 10, secret = <ignored>} __stock-deepseq__ provides three instances, that signal to the plugin how to derive @<https://hackage-content.haskell.org/package/deepseq-1.5.2.0/docs/Control-DeepSeq.html#t:NFData NFData>@, @<https://hackage-content.haskell.org/package/deepseq-1.5.2.0/docs/Control-DeepSeq.html#t:NFData1 NFData1>@, @<https://hackage-content.haskell.org/package/deepseq-1.5.2.0/docs/Control-DeepSeq.html#t:NFData2 NFData2>@. > instance DeriveStock NFData .. > instance DeriveStock1 NFData1 .. > instance DeriveStock2 NFData2 .. <https://hackage.haskell.org/package/stock stock> companion packages include: * __@stock-deepseq@__: @<https://hackage-content.haskell.org/package/deepseq-1.5.2.0/docs/Control-DeepSeq.html#t:NFData NFData>@, @<https://hackage-content.haskell.org/package/deepseq-1.5.2.0/docs/Control-DeepSeq.html#t:NFData1 NFData1>@, @<https://hackage-content.haskell.org/package/deepseq-1.5.2.0/docs/Control-DeepSeq.html#t:NFData2 NFData2>@ * __@<https://hackage.haskell.org/package/stock-hashable stock-hashable>@__: @<https://hackage-content.haskell.org/package/hashable-1.5.1.0/docs/Data-Hashable.html#t:Hashable Hashable>@, @<https://hackage-content.haskell.org/package/hashable-1.5.1.0/docs/Data-Hashable-Lifted.html#t:Hashable1 Hashable1>@, @<https://hackage-content.haskell.org/package/hashable-1.5.1.0/docs/Data-Hashable-Lifted.html#t:Hashable2 Hashable2>@ * __@<https://hackage.haskell.org/package/stock-aeson stock-aeson>@__: @<https://hackage-content.haskell.org/package/aeson-2.3.0.0/docs/Data-Aeson.html#t:ToJSON ToJSON>@, @<https://hackage-content.haskell.org/package/aeson-2.3.0.0/docs/Data-Aeson.html#t:ToJSON1 ToJSON1>@, @<https://hackage-content.haskell.org/package/aeson-2.3.0.0/docs/Data-Aeson.html#t:ToJSON2 ToJSON2>@; @<https://hackage-content.haskell.org/package/aeson-2.3.0.0/docs/Data-Aeson.html#t:FromJSON FromJSON>@, @<https://hackage-content.haskell.org/package/aeson-2.3.0.0/docs/Data-Aeson.html#t:FromJSON1 FromJSON1>@, @<https://hackage-content.haskell.org/package/aeson-2.3.0.0/docs/Data-Aeson.html#t:FromJSON2 FromJSON2>@ * __@<https://hackage.haskell.org/package/stock-quickcheck stock-quickcheck>@__: @<https://hackage-content.haskell.org/package/QuickCheck-2.18.0.0/docs/Test-QuickCheck.html#t:Arbitrary Arbitrary>@, @<https://hackage-content.haskell.org/package/QuickCheck-2.18.0.0/docs/Test-QuickCheck.html#t:Arbitrary1 Arbitrary1>@, @<https://hackage-content.haskell.org/package/QuickCheck-2.18.0.0/docs/Test-QuickCheck.html#t:Arbitrary2 Arbitrary2>@; @<https://hackage-content.haskell.org/package/QuickCheck-2.18.0.0/docs/Test-QuickCheck.html#t:CoArbitrary CoArbitrary>@ * __@<https://hackage.haskell.org/package/stock-profunctors stock-profunctors>@__: @<https://hackage-content.haskell.org/package/profunctors-5.6.3/docs/Data-Profunctor.html#t:Profunctor Profunctor>@
versionuploadeduploaderchanges
0.1.0.02026-06-23 15:43 UTCBaldurBlondal10 revisions+459/−0 lines, 5 filesdep +basedep +deepseqdep +ghc

Dependencies of stock-deepseq-0.1.0.0

base >=4.18 && <5 4.22.0.0 → 4.22.1.0
2026-12-01 12:38 UTC4.22.1.0+388/−6 lines, 9 filesdep ~ghc-internalPVP: major bump suggested
2025-12-19 11:52 UTC4.22.0.0+886/−215 lines, 28 filesdep ~ghc-internalPVP ok
2026-03-27 12:26 UTC4.21.2.0+10/−3 lines, 4 filesdep ~ghc-internalPVP ok
2025-12-27 10:31 UTC4.21.1.0+17/−5 lines, 4 filesdep ~ghc-internalPVP ok
2024-12-16 09:24 UTC4.21.0.0+1170/−396 lines, 39 filesdep ~ghc-internalPVP ok

showing 5 of 61 versions

deepseq >=1.4 && <1.6 1.5.2.0 → 1.6.0.0 newer than bounds
2024-09-08 16:18 UTC1.6.0.0 newer than bounds+5/−14 lines, 3 filesdep ~basePVP ok
2025-06-14 22:25 UTC1.5.2.0+13/−4 lines, 3 filesPVP: major bump suggested
2024-09-09 12:48 UTC1.5.1.0+69/−14 lines, 3 filesdep −arraydep ~basePVP: major bump suggested
2023-07-27 19:32 UTC1.5.0.0+619/−532 lines, 5 filesdep ~basePVP ok
2022-12-18 00:14 UTC1.4.8.1+34/−9 lines, 3 filesdep ~basePVP: major bump suggested

showing 5 of 26 versions

ghc >=9.8 && <9.16 9.14.1 → 9.14.2
2026-12-01 12:38 UTC9.14.2+9989/−5774 lines, 231 filesdep ~ghc-bootdep ~ghc-boot-thdep ~ghc-boot-th-nextPVP: major bump suggested
2025-12-19 11:51 UTC9.14.1+94968/−73927 lines, 535 filesdep +ghc-internaldep ~basedep ~containersdep ~ghc-bootsetup-changedPVP ok
2026-03-27 12:26 UTC9.12.4+3128/−1766 lines, 79 filesdep +rtsdep ~ghc-bootdep ~ghc-boot-thdep ~ghc-boot-th-nextPVP: major bump suggested
2025-12-27 10:29 UTC9.12.3+6833/−5245 lines, 117 filesdep ~ghc-bootdep ~ghc-boot-thdep ~ghc-boot-th-nextPVP: major bump suggested
2025-06-16 15:02 UTC9.12.2+182/−697 lines, 17 filesdep ~ghc-bootdep ~ghc-boot-thdep ~ghc-boot-th-nextPVP: major bump suggested

showing 5 of 51 versions

inspection-testing >=0 0.6.2 → 0.6.3
2026-01-17 15:12 UTC0.6.3+3227/−3218 lines, 24 filesdep −mtlsetup-changednew-uploaderPVP ok
2025-06-13 08:40 UTC0.6.2+159/−125 lines, 5 filesdep ~basedep ~ghcPVP ok
2025-06-11 21:55 UTC0.6.1+160/−131 lines, 4 filesPVP ok
2025-01-01 19:38 UTC0.6+41/−4 lines, 4 filesdep ~basePVP ok
2023-12-29 09:33 UTC0.5.0.3+29/−13 lines, 4 filesdep ~basedep ~ghcPVP ok

showing 5 of 29 versions

stock >=0.1 && <0.2 0.1.0.1 → 0.1.0.2
2026-06-24 09:53 UTC0.1.0.2+305/−22 lines, 9 filesdep +processdep ~basePVP ok
2026-06-24 02:18 UTC0.1.0.1+150/−101 lines, 8 filesPVP: major bump suggested
2026-06-23 14:40 UTC0.1.0.0+8536/−0 lines, 33 filesdep +basedep +ghcdep +inspection-testing

Reverse dependencies

no known reverse dependencies