[GHC] #10607: Auto derive from top to bottom

GHC ghc-devs at haskell.org
Wed Oct 21 16:06:04 UTC 2015


#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,
                                     |  typeclass, auto
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 goldfire):

 Replying to [comment:9 songzh]:
 > 2. I will try to solve it, just not sure about how to handle `TySynD`
 case.

 Have you tried `th-expand-syns`? The snippet you've given just retrieves
 the constructors (with their bound variables) of a type. The fact that
 your `A'` synonym repeats a variable `a` shouldn't affect anything. You
 should be able to just use `th-expand-syns` and then recur. I'm sorry -- I
 still don't see the problem.

 > 3.

 This is more straightforward: you have unnecessary assumptions in your
 manual `Generic` instance. Deriving `G.Generic (C a b)` does not require
 `G.Generic` instances for `a` and `b`. In your standalone-deriving
 version, you've added these, so when the default methods in `Binary` use
 `C`'s `Generic` instance, GHC also tries to get those others. Omit the
 context for your `Generic (C a b)` instance and your second example
 compiles.

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


More information about the ghc-tickets mailing list