[GHC] #12810: -Wredundant-constraints doesn't factor in associated type families

GHC ghc-devs at haskell.org
Sat Nov 5 21:08:15 UTC 2016


#12810: -Wredundant-constraints doesn't factor in associated type families
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  error/warning at compile-time      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Bah, my mental model of associated families has tripped me up once again.
 I would have sworn that this code would have been a counterexample to your
 claim:

 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}
 module M where

 class C a where
   type T a

 instance C Int where
   type T Int = Bool

 instance {- C a => -} C [a] where
   type T [a] = T a

 f :: T [Int] -> Bool
 f x = x
 }}}

 But to my surprise, that typechecks even in the absence of that `C a`
 constraint on the `C [a]` instance. So I can see your point.

 I suppose then that this is actually subsumed under #11369? Or is the
 presence of associated type families enough to make a class no longer
 "empty"?

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


More information about the ghc-tickets mailing list