[GHC] #10598: DeriveAnyClass and GND don't work well together

GHC ghc-devs at haskell.org
Fri Jul 3 02:12:38 UTC 2015


#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 rwbarton):

 The documentation says "With `-XDeriveAnyClass` you can derive any other
 class", where "other" seems to allude to the classes which can be derived
 by GHC extensions as described in sections 7.5.3 and 7.5.4 (we have to
 ignore section 7.5.5 here since the interaction with GND is described
 explicitly), as well as, presumably, the classes which can be derived in
 Haskell 2010.

 And, in fact, if you try to compile your test case with `-XDeriveAnyClass`
 only, GHC tells you
 {{{
 Test.hs:2:13:
     Can't make a derived instance of ‘Functor MyMaybe’:
       You need DeriveFunctor to derive an instance for this class
       Try GeneralizedNewtypeDeriving for GHC's newtype-deriving extension
     In the newtype declaration for ‘MyMaybe’
 }}}
 which is consistent with this interpretation (it's the same error you get
 without `-XDeriveAnyClass`).

 So, I would expect that in all cases of `deriving (Functor)`, the presence
 of `-XDeriveAnyClass` should have no effect.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10598#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list