Opened 6 years ago

Closed 6 years ago

#5617 closed bug (duplicate)

TH instance declaration quotes broken

Reported by: Lennart Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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


Compiling these and dumping splices gives the following:

TH1.hs:1:1: Splicing declarations
    instance C Int where
        { foo_aWZ = id }

    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.

Change History (1)

comment:1 Changed 6 years ago by simonpj

Resolution: duplicate
Status: newclosed

Works fine in HEAD. I think this is a dup of #5410, which I fixed in August. Ian merged it into 7.2.2 a week ago, so it should be ok in 7.2.2. Want to test the 7.2.2 RC?


Note: See TracTickets for help on using tickets.