Deriving instances for GADTs
Eq, Ord, Show can be derived using the
StandaloneDeriving
extension (implicitly using thestock
deriving strategy).To derive instances for
Some f
(wheref
is your GADT), as well asDSum f g
, you will need to use the following libraries :some
anddependent-sum
- for deriving GEq, GShow, GCompareaeson-gadt-th
- for deriving JSON instances- Use this in conjunction with
dependent-sum-aeson-orphans
to get instances forToJSON (Some f)
- Use this in conjunction with
The
kind-generics
package generalizes the approach ofGHC.Generics
to GADTs.