Template Haskell - splicing quoted instance decls mangles names
When updating a library of mine (random-fu) to build on GHC 7.2.1, I found that TH-generated instance declarations were universally broken; they did not have any class functions implemented, where in earlier versions of GHC there has never been a problem. I was able to reduce it to a very trivial case which shows that quoting and splicing is not a no-op as it seems it should be.
The entire failing case consists of:
{-# LANGUAGE TemplateHaskell #-}
module GHC_7_2_1_bug where
$([d| instance Show (a -> b) where
showsPrec _ _ = showString "<function>"
|])
which generates the following splice:
instance Show (a_a1uB -> b_a1uC) where
{ showsPrec_a1uD _ _ = showString "<function>" }
As would be expected from looking at the splice, there is no showsPrec definition, and typing "id" at the GHCi prompt gives an infinite loop from the cyclic defaults.
BTW, there is no "version" entry in the ticket reporting interface for 7.2.1, so I've left that unspecified.
Trac metadata
Trac field | Value |
---|---|
Version | |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |