-ddump-splices output doesn't match generated code for data instances inside instances.
Using the following code:
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Test where
import Language.Haskell.TH
class C a where
data D a
bang :: DecsQ
bang = return [
InstanceD [] (AppT (ConT ''C) (ConT ''Int)) [
DataInstD [] ''D [ConT ''Int] [
NormalC (mkName "T") []] []]]
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
import Language.Haskell.TH
import Test
$(bang)
When compiling the second file in GHCi with -ddump-splices set, the output is:
th-test2.hs:1:1: Splicing declarations
bang
======>
th-test2.hs:9:3-6
instance C Int where
data instance D Int = T
Ok, modules loaded: Test, Main.
This compiles successfully, but the dumped splice is clearly incorrect (which I confirmed by attempting to splice this code manually into the same place).
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |