
#13199: TH-spliced class instances are pretty-printed incorrectly post-#3384 -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The HsSyn prettyprinter tests patch 499e43824bda967546ebf95ee33ec1f84a114a7c broke the pretty-printing of Template Haskell-spliced class instances. You can see this for yourself by compiling this code with GHC HEAD: {{{#!hs {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -ddump-splices #-} module Bug where class C a b $([d| instance C a (Maybe b) |]) }}} {{{ $ ~/Software/ghc3/inplace/bin/ghc-stage2 --interactive Bug.hs GHCi, version 8.1.20170126: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:(9,3)-(10,6): Splicing declarations [d| instance C a_a1eC (Maybe b_a1eD) |] ======> instance C a_a4m5 Maybe b_a4m6 }}} Note the nonsensical `instance C a_a4m5 Maybe b_a4m6`. For comparison, here is how it should be pretty-printed: {{{ $ /opt/ghc/8.0.2/bin/ghci Bug.hs GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Bug.hs:(9,3)-(10,6): Splicing declarations [d| instance C a_a13N (Maybe b_a13O) |] ======> instance C a_a3Ju (Maybe b_a3Jv) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13199 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler