[GHC] #12814: Should GND infer an instance context when deriving method-free classes?

GHC ghc-devs at haskell.org
Tue Nov 8 20:34:03 UTC 2016


#12814: Should GND infer an instance context when deriving method-free classes?
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11369, #12810    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 It's really not simple... one instance may need other instances, so we
 need to solved simultaneous equations; see `Note [Simplifying the instance
 context]` in `TcDerivInfer`.

 Also we aren't really special-casing the 0-method case.  For each method
 we need

 1.  `C rep-ty (same for each method)
 2.  A coercible constraint (different for each method)

 Instead of generating N copies of (1) we generate just 1. But if N=0 we
 can generate zero of them.

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


More information about the ghc-tickets mailing list