
#10598: DeriveAnyClass and GND don't work well together -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by osa1): Sorry if this is a digression, but DAC just doesn't make sense to me. I think the only place it's mentioned in the user manual is here: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/deriving.htm... and it's just saying "With -XDeriveAnyClass you can derive any other class. The compiler will simply generate an empty instance." What I found confusing is: 1. It says "derive any other class", which to me means that GHC first tries other mechanisms to derive implementations, and uses DAC as a last resort, because of the word "other". E.g. if we have DF and DAC and we're trying to derive Functor, DF should always be used. If we're trying to derive something that's not supported by any other enabled extension, we should try DAC. 2. It says "the compiler will simply generate an empty instance". This works for all typeclasses, so in a sense this is most general deriving mechanism. So to me it seems like this should be tried last, not first, when we have multiple deriving mechanisms that we can use for a particular `deriving (..)` statement. E.g. it should start with most specific deriving mechanism and move to more general ones as they fail. --- @simonpj,
Once that is nailed down, it'll become clear what to do for DeriveAnyClass, I think.
If I understand correctly, you mean we should do something like this: 1. Update semantics of MINIMAL to make generic implementations counted. 2. Modify DAC to make working iff all MINIMALs have definitions. 3. Also fix problems with docs and warnings on the way. Does that sound right? Also, it seems like DeriveAnyClass is broken in some other ways(#9821, #9968). Maybe I can fix those on the way. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10598#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler