[GHC] #7524: Erroneous repeated kind variable in conflicting type family instance error message

GHC cvs-ghc at haskell.org
Sun Dec 23 05:08:24 CET 2012


#7524: Erroneous repeated kind variable in conflicting type family instance error
message
----------------------------------------------+-----------------------------
Reporter:  goldfire                           |          Owner:                  
    Type:  bug                                |         Status:  new             
Priority:  normal                             |      Component:  Compiler        
 Version:  7.7                                |       Keywords:                  
      Os:  Unknown/Multiple                   |   Architecture:  Unknown/Multiple
 Failure:  Incorrect warning at compile-time  |      Blockedby:                  
Blocking:                                     |        Related:                  
----------------------------------------------+-----------------------------
 Consider the following code:

 {{{
 {-# LANGUAGE TypeFamilies, PolyKinds #-}

 type family F (a :: k1) (b :: k2)
 type instance F a a = Int
 type instance F a b = Bool
 }}}

 GHC correctly complains that these instances overlap. The error message is
 this:

 {{{
 /Users/rae/temp/Scratch.hs:4:15:
     Conflicting family instance declarations:
       F k k a a -- Defined at /Users/rae/temp/Scratch.hs:4:15
       F k k a b -- Defined at /Users/rae/temp/Scratch.hs:5:15
 }}}

 The problem is the repeated {{{k}}} kind variable in the second line,
 above. The type variables {{{a}}} and {{{b}}} can have different kinds, so
 the kind variables should be, say, {{{k1}}} and {{{k2}}}. (The repeated
 {{{k}}} variable in the first line is correct.)

 While I realize I have been playing around most recently in the type
 family code, I think this problem is further up the chain than where I've
 been writing.... it would seem to be that whatever code generates kind
 variables is generating multiple ones with the same name (but hopefully
 different Uniques!). This behavior is the same in 7.6.1 as it is in HEAD
 (7.7.20121221).

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



More information about the Glasgow-haskell-bugs mailing list