[RFC] Support Unicode characters in instance Show String

Oleg Grenrus oleg.grenrus at iki.fi
Thu Jul 8 17:17:06 UTC 2021

Yes, I think someone already mentioned that Haskell Report 2010 says for

    showLitChar :: Char -> ShowS

        Convert a character to a string using only printable characters,
using Haskell source-language escape conventions. For example:

        showLitChar '\n' s  =  "\\n" ++ s

With the

    isPrint :: Char -> Bool

    Selects printable Unicode characters (letters, numbers, marks,
punctuation, symbols and spaces).

being one obvious, yet unused, definition.

Also if one looks at the history of GHC, the showLitChar have been
essentially unchanged since 2001 when it was introduced to the source tree.

So while technically it won't be deviation from the report,
I don't think "technically correct" is necessarily correct here.

- Oleg

On 8.7.2021 19.38, Bardur Arantsson wrote:
> On 08/07/2021 17.53, Oleg Grenrus wrote:
> [--snip--]
>> 78 out of 2819 tests failed (35.88s)
> The use of Show in 'golden' test suites is interesting because Show
> doesn't really guarantee any real form of stability in its output.
> I guess Hyrum's Law applies here too.
> Anyway... just an idle observation. Obviously, breaking loads of test
> suites is going to be hard to swallow.
> Regards,
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

More information about the Libraries mailing list