#5617: TH instance declaration quotes broken
---------------------------------+------------------------------------------
    Reporter:  Lennart           |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  7.2.1             |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 Instance declaration quotes and splices are broken in two way.
 Consider these modules:
 {{{
 module TH where
 import Language.Haskell.TH

 class C a where
     foo :: a -> Int

 bar = [d| instance C Int where foo = id |]

 module TH1 where
 import Language.Haskell.TH
 import TH

 $bar
 }}}

 Compiling these and dumping splices gives the following:
 {{{
 TH1.hs:1:1: Splicing declarations
     bar
   ======>
     TH1.hs:6:1-4
     instance C Int where
         { foo_aWZ = id }

 TH1.hs:6:1:
     Warning: No explicit method nor default method for `foo'
     In the instance declaration for `C Int'
 }}}

 Note how the {{{foo}}} method has been renamed to {{{foo_aWZ}}}.  This is
 the first bug.
 The second bug is that there is no sanity check to make sure instance
 declarations only contain the methods of the class and not some other
 junk.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5617>
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