[GHC] #11529: Show instance of Char should print literals for non-ascii printable charcters

GHC ghc-devs at haskell.org
Wed Feb 17 16:51:13 UTC 2016


#11529: Show instance of Char should print literals for non-ascii printable
charcters
-------------------------------------+-------------------------------------
        Reporter:  nushio            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 I would love for something like comment:4 to become the default in ghci.
 It could even be simpler/stupider and just replace any sequence like
 `\12345` with the corresponding Unicode character wherever it appears. I
 mean when would you ever have such a string in the output of `show`, short
 of a weird custom Show instance? And it would be more robust to other
 weird custom Show instances, that used quotes in an unbalanced fashion.

 I don't think we should replace `\n` or `\ESC` or especially `\\` though.
 Just printable Unicode characters outside the ASCII range, probably. And
 we could decline to do the replacement if the replacement character can't
 be encoded in the user's locale.

 One drawback is that the user's font might not contain the Unicode
 characters in question, like mine does not contain `\12345`. So there
 should probably be an option to disable these replacements.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11529#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list