
#10598: DeriveAnyClass and GND don't work well together -------------------------------------+------------------------------------- Reporter: osa1 | Owner: RyanGlScott Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Generics Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by oerjan): As Ryan implies, Simon's suggestion seems precisely equivalent to abolishing `DeriveAnyClass` altogether. And the entire point of that extension is to extend `deriving` clauses to allow user-defined classes. OK, so the class annotation idea is not backwards compatible across actually adding those annotations. At least that would seem to need a major version change. Maybe they could still be useful to enable warnings if the program is implicitly using the non-recommended derivation type. This could easily happen if a module lists the wrong GND/DAC language extension. Your `ToJSON` example is instructive, in that a programmer might very well want either version, and in that there's already a problem ''today'' if the module lists the wrong language extensions. As for your last example, I meant for all of this to have no effect at all on `data` types. But on the other hand, an annotation of `{-# GND #-}` might strongly imply that a class is ''not'' designed to support DAC, and so suggest a warning. Which now makes me realize that it may be reasonable for some classes to support both, at least if they are equivalent in result (and then, probably more efficient with GND.) It's getting pretty obvious here that some of my design goals are inconsistent with each other. I'd suggest erring on the side of giving warnings unless the user is being explicit. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10598#comment:30 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler