[GHC] #13183: Template Haskell needlessly pretty-prints empty instance contexts

#13183: Template Haskell needlessly pretty-prints empty instance contexts -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Template | Version: 8.1 Haskell | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- This code: {{{#!hs {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS -ddump-splices #-} module Bug where $([d| class Foo a instance Foo Int |]) }}} Used to pretty-print like this on GHC 8.0.2: {{{ Bug2.hs:(5,3)-(7,6): Splicing declarations [d| class Foo_a13B a_a13C instance Foo_a13B Int |] ======> class Foo_a3Jo a_a3Jp instance Foo_a3Jo Int }}} But on GHC HEAD, it prints a redundant instance context! {{{ Bug2.hs:(5,3)-(7,6): Splicing declarations [d| class Foo_a1eh a_a1ei instance Foo_a1eh Int |] ======> class Foo_a4ly a_a4lz instance () => Foo_a4ly Int }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13183 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13183: Template Haskell needlessly pretty-prints empty instance contexts -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Template Haskell | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: alanz (added) Comment: This was introduced in 499e43824bda967546ebf95ee33ec1f84a114a7c (Add HsSyn prettyprinter tests). Alan, do you know what might be causing this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13183#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13183: Template Haskell needlessly pretty-prints empty instance contexts -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Template Haskell | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Ah, I see that 499e43824bda967546ebf95ee33ec1f84a114a7c introduced a function called `pprHsContextAlways` which, as the name suggests, //always// prints out the context for an `HsQualTy`, even if it's empty. Is the solution here not to use `pprHsContextAlways` when printing out Template Haskell-spliced code? Or perhaps we should avoid constructing an `HsQualTy` in `hsSyn/Convert` when [http://git.haskell.org/ghc.git/blob/65cc7620517abec9b3e0d9bfe644accd5f649fe5... converting] a Template Haskell `InstanceD` into a `ClsInstDecl`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13183#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13183: Template Haskell needlessly pretty-prints empty instance contexts -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: patch Priority: normal | Milestone: 8.2.1 Component: Template Haskell | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3018 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D3018 Comment: I think the second option is cleaner, so I went with that approach in Phab:D3018. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13183#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13183: Template Haskell needlessly pretty-prints empty instance contexts
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: patch
Priority: normal | Milestone: 8.2.1
Component: Template Haskell | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Other | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3018
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#13183: Template Haskell needlessly pretty-prints empty instance contexts -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Template Haskell | Version: 8.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3018 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13183#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC