[GHC] #5939: Standalone deriving Generic on type with instantiated arguments

GHC cvs-ghc at haskell.org
Sun Apr 22 16:37:18 CEST 2012


#5939: Standalone deriving Generic on type with instantiated arguments
------------------------------+---------------------------------------------
 Reporter:  dreixel           |          Owner:  dreixel         
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.5               |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
Changes (by dreixel):

  * version:  7.4.1 => 7.5


Comment:

 This is actually a bit harder than I thought. Right now the representation
 type is generated only from the tycon of `T`. I can get the instantiated
 type (`T Bool`) from the `ds_tys` field of the `DerivSpec` at `genInst`,
 but I'm not sure how I can relate the type variables to the instantiated
 types. For instance:
 {{{
 data T a b c = T a b c
 deriving instance Generic (T a Bool c)
 }}}
 The representation should look something like:
 {{{
 type instance Rep (T a Bool c) = a :*: Bool :*: c
 }}}
 But since the function that generates the representation (`tc_mkRepTy`)
 only takes the tycon of `T`, it won't know that `b` has been instantiated
 to `Bool`. Even if I pass it the full instantiated type `T a Bool c`, how
 can I easily relate the tycon's variables to their instantiated types?

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



More information about the Glasgow-haskell-bugs mailing list