
To me, this looks like the perfect application of Template Haskell. Yes,
#10607: Auto derive from top to bottom -------------------------------------+------------------------------------- Reporter: songzh | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: deriving, Operating System: Unknown/Multiple | typeclass, auto Type of failure: None/Unknown | Architecture: Blocked By: | Unknown/Multiple Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by songzh): Yes you are right, this is can be one application of TH. However, I am only a newbie of TH, I find I cannot query whether type like `Eq a => List a` is an instance of `Eq` with TH. And there are also other problems for me to implement it, like the situation type synonym with type variables. Any Template Haskell expert would like to work this out? Replying to [comment:3 goldfire]: this ''could'' be built into GHC, but this seems like one step too far. If you're keen on this being built-in, perhaps seek out support on mailing lists and such to see whether others agree. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10607#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler