#1825: standalone deriving for typeable fails
------------------------+---------------------------------------------------
 Reporter:  jpbernardy  |          Owner:  simonpj
     Type:  bug         |         Status:  new    
 Priority:  normal      |      Milestone:  6.8.2  
Component:  Compiler    |        Version:  6.8.1  
 Severity:  normal      |     Resolution:         
 Keywords:              |     Difficulty:  Unknown
 Testcase:              |   Architecture:  Unknown
       Os:  Unknown     |  
------------------------+---------------------------------------------------
Changes (by simonpj):

  * owner:  => simonpj
  * milestone:  => 6.8.2

Comment:

 Oh bother!  The deriving for `Typeable` is unique.  If you use the
 `deriving` clause on the `data` decl, you'll get this instance:
 {{{
 instance Typeable1 D where
   typeOf1 _ = mkTyConApp (mkTyCon "D") []
 }}}
 So that's what the user should write in a standalone deriving clause too.
 thus
 {{{
 deriving instance Typeable1 D
 }}}
 (There's a uniform instance for type applications.)

 Sadly, GHC 6.8.1 rejects the above because "`Typeable1` is not a derivable
 class".

 Ok so this is broken and there's no workaround.  I will milestone it for
 6.8.1.  What I propose is to require you to write "`deriving instance
 Typeable1 D`".  That's not as obvious as the declaration you started with,
 but it fits with the current impl, and with the (current) Typeable design;
 see Section 7.4 of [http://www.cs.vu.nl/boilerplate/gmap2.pdf the second
 SYB paper].

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1825#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to