Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.6k
    • Issues 5.6k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 663
    • Merge requests 663
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Analytics
    • Analytics
    • 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
  • #5410

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