stock-aeson
Derive ToJSON / FromJSON via the stock plugin
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-aeson__ extends it to support
@<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:FromJSON FromJSON>@, and their higher-kinded variants.
> {-# options_ghc -fplugin Stock #-}
>
> {-# language DerivingVia #-}
>
> import Stock
> import Stock.Aeson
>
> data Person = P { name :: String, age :: Int }
> deriving (ToJSON, FromJSON) via
> Stock Person
The wire format reproduces
@<https://hackage.haskell.org/package/aeson aeson>@'s
@genericToJSON@ \/ @genericParseJSON
defaultOptions@. __stock-aeson__ is a drop-in for @deriving anyclass
(ToJSON, FromJSON)@.
__stock-aeson__ provides six instances, that signal to the plugin
how to derive
@<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:FromJSON FromJSON>@.
> instance DeriveStock ToJSON ..
> instance DeriveStock1 ToJSON1 ..
> instance DeriveStock2 ToJSON2 ..
> instance DeriveStock FromJSON ..
> instance DeriveStock1 FromJSON1 ..
> instance DeriveStock2 FromJSON2 ..
The lifted variants derive the same zero-cost way (no @Generic@ at
runtime): parameter fields route through the supplied per-parameter
encoders\/parsers, so the bytes still match @aeson@'s generic
deriving.
> data F a = MkF a [a] deriving (ToJSON1, FromJSON1) via Stock1 F
> data P a b = MkP a b [b] deriving (ToJSON2, FromJSON2) via Stock2 P
<https://hackage.haskell.org/package/stock stock> companion packages include:
* __@<https://hackage.haskell.org/package/stock-deepseq 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>@
* __@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>@
| version | uploaded | uploader | changes | |
|---|---|---|---|---|
| 0.1.0.0 | 2026-06-23 15:43 UTC | BaldurBlondal | 5 revisions | +902/−0 lines, 4 filesdep +aesondep +basedep +bytestring |
Dependencies of stock-aeson-0.1.0.0
aeson >=2 && <3 2.3.2.0 → 2.3.3.0
| 2026-11-23 21:23 UTC | 2.3.3.0 | +124/−38 lines, 10 filesPVP ok |
| 2026-09-12 18:04 UTC | 2.3.2.0 | +97/−60 lines, 13 filesPVP ok |
| 2026-07-05 10:37 UTC | 2.3.1.0 | +101/−42 lines, 17 filesdep ~text-iso8601PVP ok |
| 2026-05-21 08:35 UTC | 2.3.0.0 | +54/−41 lines, 17 filesdep ~nothunksdep ~text-iso8601new-uploaderPVP ok |
| 2026-08-29 13:20 UTC | 2.2.5.1 | +36/−24 lines, 4 filesnew-uploaderPVP ok |
showing 5 of 106 versions
base >=4.18 && <5 4.22.0.0 → 4.22.1.0
| 2026-12-01 12:38 UTC | 4.22.1.0 | +388/−6 lines, 9 filesdep ~ghc-internalPVP: major bump suggested |
| 2025-12-19 11:52 UTC | 4.22.0.0 | +886/−215 lines, 28 filesdep ~ghc-internalPVP ok |
| 2026-03-27 12:26 UTC | 4.21.2.0 | +10/−3 lines, 4 filesdep ~ghc-internalPVP ok |
| 2025-12-27 10:31 UTC | 4.21.1.0 | +17/−5 lines, 4 filesdep ~ghc-internalPVP ok |
| 2024-12-16 09:24 UTC | 4.21.0.0 | +1170/−396 lines, 39 filesdep ~ghc-internalPVP ok |
showing 5 of 61 versions
bytestring >=0 0.12.1.0 → 0.12.2.0
| 2024-12-06 21:41 UTC | 0.12.2.0 | +538/−437 lines, 44 filesdep ~QuickCheckdep ~basePVP ok |
| 2024-02-16 03:27 UTC | 0.12.1.0 | +3398/−1642 lines, 37 filesdep +sybdep ~basePVP: major bump suggested |
| 2023-08-16 01:53 UTC | 0.12.0.2 | +16/−2 lines, 3 files |
| 2023-08-05 00:03 UTC | 0.12.0.1 | +47/−9 lines, 3 files |
| 2023-07-07 01:45 UTC | 0.12.0.0 | +1459/−520 lines, 21 filesdep +data-array-bytePVP ok |
showing 5 of 49 versions
ghc >=9.6 && <9.16 9.14.1 → 9.14.2
| 2026-12-01 12:38 UTC | 9.14.2 | +9989/−5774 lines, 231 filesdep ~ghc-bootdep ~ghc-boot-thdep ~ghc-boot-th-nextPVP: major bump suggested |
| 2025-12-19 11:51 UTC | 9.14.1 | +94968/−73927 lines, 535 filesdep +ghc-internaldep ~basedep ~containersdep ~ghc-bootsetup-changedPVP ok |
| 2026-03-27 12:26 UTC | 9.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 UTC | 9.12.3 | +6833/−5245 lines, 117 filesdep ~ghc-bootdep ~ghc-boot-thdep ~ghc-boot-th-nextPVP: major bump suggested |
| 2025-06-16 15:02 UTC | 9.12.2 | +182/−697 lines, 17 filesdep ~ghc-bootdep ~ghc-boot-thdep ~ghc-boot-th-nextPVP: major bump suggested |
showing 5 of 51 versions
stock >=0.1 && <0.2 0.1.0.1 → 0.1.0.2
| 2026-06-24 09:53 UTC | 0.1.0.2 | +305/−22 lines, 9 filesdep +processdep ~basePVP ok |
| 2026-06-24 02:18 UTC | 0.1.0.1 | +150/−101 lines, 8 filesPVP: major bump suggested |
| 2026-06-23 14:40 UTC | 0.1.0.0 | +8536/−0 lines, 33 filesdep +basedep +ghcdep +inspection-testing |
Reverse dependencies
no known reverse dependencies