[GHC] #6081: Kind variables not allowed in class instance declarations

GHC cvs-ghc at haskell.org
Sat May 5 23:11:02 CEST 2012


#6081: Kind variables not allowed in class instance declarations
------------------------------+---------------------------------------------
 Reporter:  goldfire          |          Owner:                         
     Type:  bug               |         Status:  new                    
 Priority:  normal            |      Component:  Compiler (Type checker)
  Version:  7.5               |       Keywords:  PolyKinds              
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple       
  Failure:  None/Unknown      |       Testcase:                         
Blockedby:                    |       Blocking:                         
  Related:  6064              |  
------------------------------+---------------------------------------------
 Consider the following code:

 {{{
 {-# LANGUAGE KindSignatures, PolyKinds, DataKinds, RankNTypes #-}

 data KProxy (a :: *) = KP

 class KindClass (kp :: KProxy k)
 instance KindClass (KP :: KProxy [k])
 }}}

 The last line fails to compile, producing the following error message:

 {{{
   Not in scope: type variable `k'
 }}}

 However, there is a workaround. When I change the last line to

 {{{
 instance forall (a :: k). KindClass (KP :: KProxy [k])
 }}}

 all is good. Unfortunately, this last line requires the declaration of an
 unused type variable {{{a}}}, which is a little messy.

 This was tested on 7.5.20120426.

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



More information about the Glasgow-haskell-bugs mailing list