[GHC] #12142: -Wredundant-constraints warns about constraints introduced via type synonyms.

GHC ghc-devs at haskell.org
Wed Jun 1 22:54:49 UTC 2016


#12142: -Wredundant-constraints warns about constraints introduced via type
synonyms.
-------------------------------------+-------------------------------------
           Reporter:  scshunt        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Linux
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I ran into this when using lens, here's a simplied example:

 {{{#!hs
 l :: Getter [a] Int
 l = to length
 }}}

 In this case, Getter introduces constraints (Functor f, Contravariant f),
 but the Functor constraint is not used. This leads to a warning from
 -Wredundant-constraints:

 {{{
 <interactive>:1:6: warning: [-Wredundant-constraints]
     • Redundant constraint: Functor f
     • In the type signature for:
            l :: (Contravariant f, Functor f) => (Int -> f Int) -> [a] -> f
 [a]
 }}}

 This shouldn't warn, because the constraints were introduced by type
 synonym and so may well be opaque to the user.

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


More information about the ghc-tickets mailing list