packages feed

stock

Stock-style deriving via coercion, with no Generic

view on Hackage

A GHC type-checker plugin that derives class instances for __@<https://hackage-content.haskell.org/package/stock-0.1.0.2/docs/Stock.html#t:Stock Stock T>@__ and higher-kinded variants at /compile time/, straight from the structure of /T/ without a @Generic@ representation or runtime cost. Synthesized instances emulate GHC's /stock/ deriving. Supported classes: * __@<https://hackage-content.haskell.org/package/stock-0.1.0.2/docs/Stock.html#t:Stock Stock>@__: @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Eq.html#t:Eq Eq>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Ord.html#t:Ord Ord>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Text-Show.html#t:Show Show>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Text-Read.html#t:Read Read>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Semigroup.html#t:Semigroup Semigroup>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Monoid.html#t:Monoid Monoid>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Prelude.html#t:Enum Enum>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Prelude.html#t:Bounded Bounded>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Ix.html#t:Ix Ix>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/GHC-Generics.html#t:Generic Generic>@ * __@<https://hackage-content.haskell.org/package/stock-0.1.0.2/docs/Stock.html#t:Stock1 Stock1>@__: @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor.html#t:Functor Functor>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Foldable.html#t:Foldable Foldable>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Traversable.html#t:Traversable Traversable>@,† @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Contravariant.html#t:Contravariant Contravariant>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Control-Applicative.html#t:Applicative Applicative>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Eq1 Eq1>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Ord1 Ord1>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Show1 Show1>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Read1 Read1>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/GHC-Generics.html#t:Generic1 Generic1>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Type-Equality.html#t:TestEquality TestEquality>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Type-Coercion.html#t:TestCoercion TestCoercion>@ * __@<https://hackage-content.haskell.org/package/stock-0.1.0.2/docs/Stock.html#t:Stock2 Stock2>@__: @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Bifunctor.html#t:Bifunctor Bifunctor>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Bifoldable.html#t:Bifoldable Bifoldable>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Bitraversable.html#t:Bitraversable Bitraversable>@,† @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Eq2 Eq2>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Ord2 Ord2>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Show2 Show2>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Functor-Classes.html#t:Read2 Read2>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Control-Category.html#t:Category Category>@ † @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Traversable.html#t:Traversable Traversable>@, @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Bitraversable.html#t:Bitraversable Bitraversable>@ are synthesisable but cannot be used with @DerivingVia@ due to role issues. Companion packages add more classes through @DeriveStock@ instances (see "Stock.Derive"), discovered automatically without an extra @-fplugin@ flag: * __@<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>@ * __@<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>@ Ordinary @DerivingVia@ modifiers compose with <https://hackage-content.haskell.org/package/stock-0.1.0.2/docs/Stock.html#t:Stock Stock>: * @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Ord.html#t:Down Down (Stock T)>@ reverses ordering, enumeration and bounds * @<https://hackage-content.haskell.org/package/transformers-0.6.3.0/docs/Control-Applicative-Backwards.html#t:Backwards Backwards (Stock1 F)>@ reverses @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Control-Applicative.html#t:Applicative Applicative>@ effects * @<https://hackage-content.haskell.org/package/transformers-0.6.3.0/docs/Data-Functor-Reverse.html#t:Reverse Reverse (Stock1 F)>@ reverses @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Foldable.html#t:Foldable Foldable>@ \/ @<https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Traversable.html#t:Traversable Traversable>@ > {-# options_ghc -fplugin Stock #-} > {-# language DerivingVia #-} > > import Stock > import Data.Ord (Down(..)) > > -- >>> sort [Bronze,Silver,Gold] > -- [Gold,Silver,Bronze] > data Place = Bronze | Silver | Gold > deriving (Eq, Show) via Stock Place > deriving (Ord, Bounded, Enum) via Down (Stock Place) Per-field modifiers (@Override@, "Stock.Override", re-exported by "Stock") customise individual fields by name, type, or position; @_@ leaves a field unchanged. A modifier is any newtype with the relevant instance. This game example shows hit points and coins accumulate with addition, poisoning contaminates by disjunction (or), @items@, and @weapons@ union with addition to produce a multiset. > import Data.Map.Monoidal (MonoidalMap(..)) > > type MultiSet key = MonoidalMap key (Sum Int) > > data Inventory = Inventory > { hp :: Int -- (+) > , coins :: Int -- (+) > , poisoned :: Bool -- (||) > , items :: Map Item Int -- unionWith (+) > , weapons :: Map Weapon Int -- unionWith (+) > } > deriving (Eq, Ord, Show, Read) via > Stock Inventory > deriving (Semigroup, Monoid) via > Overriding Inventory > '[ hp via Sum > , coins via Sum > , poisoned via Any > , items via MultiSet Item > , weapons via MultiSet Weapon > ] Synthesis runs once per instance (not per use): @deriving Cls via Stock T@ produces a single shared @instance Cls T@ that every call reuses.
versionuploadeduploaderchanges
0.1.0.22026-06-24 09:53 UTCBaldurBlondal+305/−22 lines, 9 filesdep +processdep ~basePVP ok
0.1.0.12026-06-24 02:18 UTCBaldurBlondal+150/−101 lines, 8 filesPVP: major bump suggested
0.1.0.02026-06-23 14:40 UTCBaldurBlondal14 revisions+8536/−0 lines, 33 filesdep +basedep +ghcdep +inspection-testing

Dependencies of stock-0.1.0.2

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

ghc >=9.6 && <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

process >=0 1.6.29.0 → 1.6.30.0
2026-06-11 10:14 UTC1.6.30.0+19/−1 lines, 2 filesPVP ok
2026-05-24 11:03 UTC1.6.29.0+5282/−4831 lines, 7 filesdep ~basePVP ok
2026-04-18 12:18 UTC1.6.28.0+70/−33 lines, 3 filesPVP ok
2026-03-08 19:39 UTC1.6.27.0+3/−2 lines, 2 filesPVP ok
2026-03-07 13:46 UTC1.6.26.2+4852/−5346 lines, 7 filesPVP ok

showing 5 of 57 versions

transformers <0.7 0.6.2.0 → 0.6.3.0
2026-01-12 12:42 UTC0.6.3.0+28/−1 lines, 4 filesPVP: major bump suggested
2025-04-06 22:39 UTC0.6.2.0+41/−42 lines, 8 filesdep ~ghc-primPVP: major bump suggested
2024-09-25 11:37 UTC0.6.1.2+70/−21 lines, 19 filesPVP: minor bump suggested
2023-08-01 19:13 UTC0.6.1.1+281/−42 lines, 11 filesPVP ok
2023-02-04 08:15 UTC0.6.1.0+64/−4 lines, 8 filesPVP ok

showing 5 of 42 versions

Reverse dependencies

5 packages depend on stock

stock-aeson 0.1.0.0 requires stock >=0.1 && <0.2
stock-deepseq 0.1.0.0 requires stock >=0.1 && <0.2
stock-hashable 0.1.0.0 requires stock >=0.1 && <0.2
stock-profunctors 0.1.0.0 requires stock >=0.1 && <0.2
stock-quickcheck 0.1.0.0 requires stock >=0.1 && <0.2