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

GHC ghc-devs at haskell.org
Tue Nov 8 17:37:36 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):

 The rationale is this.

 * For 'deriving' clauses we need to figure out what the context of the
 derived instance declaration should be.

 * What we ''actually'' do is this: we gather together all the constraints
 that ''will'' be required, and simplify them to make a minimal instance
 context.

 * We could instead (a) generate the method bindings etc, (b) typecheck
 them, (c) figuring out the constraints that are needed to do so, and
 minimise them (d) turn all that into an instance decl (e) typecheck the
 instance decl with all its methods.  But typechecking instance decls is
 already fairly complicated and (a-c) sounds tricky to me.

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


More information about the ghc-tickets mailing list