
#15790: String literals are not escaped in -ddump-splices -------------------------------------+------------------------------------- Reporter: michalrus | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #4436 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by michalrus): I see. =) But isn’t output of `-ddump-splices` supposed to be valid Haskell? If it was, then that would settle it. The manual says:
`-ddump-splices`
Dump Template Haskell expressions that we splice in, and **what Haskell code** the expression evaluates to.
— https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/debugging.ht... #ghc-flag--ddump-splices
At the same time, I can see the reasoning behind breaking such strings in #4436. After all, it’s a debugging flag, with output meant for human consumption. I’d like to propose, then, in line with #13190’s ideas, a patch, which causes `-ddump-splices` output to be JSON if the `-ddump-json` flag is present, and in which JSON the string literals would be escaped properly, as they would be in valid Haskell code? This way we get a clear distinction between human– and machine-targeted output. Would that be accepted? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15790#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler