Parameterizing Stock instance deriving
Motivation
See the original request on haskell-cafe ML: https://mail.haskell.org/pipermail/haskell-cafe/2019-September/131503.html
Proposal
Allow this syntax:
data E = ...
deriving stock Eq via myTransformer
myTransformer :: E -> E
myTransformer = ...
This would mean that myTransformer
is applied to the values before they are passed to the derived class functions ((==)
, etc.).
This extension would require a GHC proposal.