[RFC] Support Unicode characters in instance Show String

Viktor Dukhovni ietf-dane at dukhovni.org
Sun Jul 11 16:46:42 UTC 2021

On Sun, Jul 11, 2021 at 03:11:02PM +0300, Oleg Grenrus wrote:

> This is tricky design. Any instance in the composition which doesn't
> define showsPrecUnicode will ruin formatting of inner Strings.
> Maybe it's not as bad as in aeson* as most Show instances are derived.
> (But not Show1 etc.)

Yes, if a manually defined instance uses `show` on a substructure that
contains strings, the strings will be rendered with unicode characters

As you note, the ability to retain Unicode representations of nested
structures would depend on either derived instances or tweaks to
manual instances to also define the Unicode-preserving methods.

This would not be perfect, but would avoid disruption, and so should
have a much easier path to deployment.  Over time the instances that
fail to preserve Unicode strings can be refined.

If tests in various packages are incrementally changed to use
`showUnicode` to verify expected output, eventually we may be able to
make `show` also Unicode-preserving, with much less disruption.

This can provide a migration path over O(10yr) from the status quo to a
Unicode-friendly `show`.


More information about the Libraries mailing list