[GHC] #6088: GeneralizedNewtypeDeriving + TypeFamilies + Equality constraints

GHC ghc-devs at haskell.org
Fri Nov 11 04:50:42 UTC 2016


#6088: GeneralizedNewtypeDeriving + TypeFamilies + Equality constraints
-------------------------------------+-------------------------------------
        Reporter:  Lemming           |         Owner:
            Type:  feature request   |        Status:  closed
        Priority:  normal            |     Milestone:
       Component:  Compiler (Type    |       Version:  7.4.1
  checker)                           |
      Resolution:  fixed             |      Keywords:
Operating System:  Unknown/Multiple  |  Architecture:  Unknown/Multiple
 Type of failure:  GHC rejects       |     Test Case:  indexed-
  valid program                      |  types/should_compile/T6088
      Blocked By:                    |      Blocking:
 Related Tickets:  3046              |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"03e8d26fe0a8f7981a76550118f3c584cad76c47/ghc"
 03e8d26f/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="03e8d26fe0a8f7981a76550118f3c584cad76c47"
 Prevent GND from inferring an instance context for method-less classes

 When `GeneralizedNewtypeDeriving` is used with a type class that has no
 methods, it will generate a redundant context, and as a result, it can
 trigger warnings when compiled with `-Wredundant-constraints`. This is a
 simple change in behavior to check beforehand if a class has methods
 when deriving it with GND, and if it has no methods, avoid inferring the
 redundant context.

 Beware that the test for #6088, which used to be expected to fail, now
 compiles without issue since it doesn't infer a problematic instance
 context.

 Thanks to Simon Peyton Jones for doing the necessary refactoring in
 f05d685ae05ec293083f2fa7ec7ba057fbe64869.

 Fixes #12814.

 Test Plan: ./validate

 Reviewers: goldfire, rwbarton, simonpj, austin, bgamari

 Reviewed By: simonpj

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D2692

 GHC Trac Issues: #12814
 }}}

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


More information about the ghc-tickets mailing list