Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,359
    • Issues 5,359
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 571
    • Merge requests 571
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #7532
Closed
Open
Issue created Dec 26, 2012 by Aninhumer@trac-Aninhumer

-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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking