stock-hashable: Derive Hashable via the stock plugin

[ bsd3, library, type-system ] [ Propose Tags ] [ Report a vulnerability ]

The stock plugin provides a newtype Stock for deriving and synthesising instances at compile time. stock-hashable extends it to support Hashable, and higher-kinded variants.

{-# options_ghc -fplugin Stock #-}

{-# language DerivingVia #-}

import Stock
import Stock.Hashable

data Pair a b = Pair a b
 deriving (Eq,  Hashable)  via Stock  (Pair a b)
 deriving (Eq1, Hashable1) via Stock1 (Pair a)
 deriving (Eq2, Hashable2) via Stock2 Pair

stock-hashable provides three instances, that signal to the plugin how to derive Hashable, Hashable1 and Hashable2.

instance DeriveStock  Hashable  ..
instance DeriveStock1 Hashable1 ..
instance DeriveStock2 Hashable2 ..

stock companion packages include:

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Dependencies base (>=4.18 && <5), ghc (>=9.6 && <9.16), hashable (>=1.4 && <1.6), stock (>=0.1 && <0.2) [details]
Tested with ghc ==9.8.1, ghc ==9.10.3, ghc ==9.12.4, ghc ==9.14.1, ghc ==9.10.3, ghc ==9.12.4, ghc ==9.14.1
License BSD-3-Clause
Author Baldur Blöndal
Maintainer baldur.blondal@iohk.io
Uploaded by BaldurBlondal at 2026-06-23T15:43:49Z
Revised Revision 5 made by BaldurBlondal at 2026-06-24T01:45:36Z
Category Type System
Source repo head: git clone https://github.com/Icelandjack/stock.git(hashable)
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-06-23 [all 1 reports]