[GHC] #11369: Suppress redundant-constraint warnings in case of empty classes

GHC ghc-devs at haskell.org
Sun Nov 6 14:21:31 UTC 2016


#11369: Suppress redundant-constraint warnings in case of empty classes
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11370            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Another use case for this emerged in #12810. Now that we can use GND for
 deriving instances of classes with associated type families, it's quite
 easy to trigger `-Wredundant-constraints` with code like this:

 {{{#!hs
 {-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies #-}
 class C a where
   type T a

 newtype Identity a = Identity a deriving C
 }}}

 as it will generate the following instance:

 {{{#!hs
 instance C a => C (Identity a) where
   type T (Identity a) = T a
 }}}

 and GHC will emit this warning:

 {{{
 • Redundant constraint: C a
 • In the instance declaration for ‘C (Identity a)’
 }}}

 Now we have examples where GHC-generated code is producing warnings, which
 is disconcerting.

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


More information about the ghc-tickets mailing list