cabal-version: 3.0 name: stock-aeson version: 0.1.0.0 x-revision: 4 synopsis: Derive ToJSON / FromJSON via the stock plugin description: The plugin provides a newtype __@@__ for deriving and synthesising instances at compile time. __stock-aeson__ extends it to support @@, @@, 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 @@'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 @@, @@. > 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 companion packages include: * __@@__: @@, @@, @@ * __@@__: @@, @@, @@ * __@stock-aeson@__: @@, @@, @@; @@, @@, @@ * __@@__: @@, @@, @@; @@ * __@@__: @@ license: BSD-3-Clause license-file: LICENSE author: Baldur Blöndal maintainer: baldur.blondal@iohk.io category: Type System build-type: Simple tested-with: GHC == 9.8.1, GHC == 9.10.3, GHC == 9.12.4, GHC == 9.14.1 library exposed-modules: Stock.Aeson build-depends: base >=4.18 && <5, ghc >=9.6 && <9.16, stock >=0.1 && <0.2, aeson >=2 && <3 hs-source-dirs: . default-language: GHC2021 ghc-options: -Wall test-suite test type: exitcode-stdio-1.0 main-is: Test.hs build-depends: base, stock, stock-aeson, aeson, bytestring ghc-options: -fplugin=Stock hs-source-dirs: test default-language: GHC2021 source-repository head type: git location: https://github.com/Icelandjack/stock.git subdir: aeson