Add non-escaping show functions

Edward Kmett ekmett at
Mon Dec 20 16:02:35 UTC 2021

I have some concerns that this is not as general as it could be and that it
is more invasive than one might think to "do this right."

e.g. One usecase where custom Show instances are often written is to take a
record type and transform it into something that shows with just a
positional constructor. This typically delegates to the existing showsPrec
of the fields.

I'd kind of expect "showNE" to do something sensible for such a record, but
here it'll get delegated away by default to the normal implementation,
which will delegate to showsPrec not something that tries to preserve this
property for its part.

You could move to using a 'showsPrecNE' instead of 'showNE' to enable you
to walk down to those leaf level strings you want to escape, but now
anything with a non-trivial Show instance is going to require two copies of
that non-trivial showsPrec code to be put in place.

Without something like that, as written, this proposal would make it so you
get very different output for "some unicode string" and ("some unicode
string","some other unicode string"), which seems less than optimal.

On the other hand, duplicating all the work in custom Show instances also
seems suboptimal.

I don't have a solution that I like, though several options present
themselves, but I did want to throw up this concern before folks ran away
and pushed this into base.


On Sun, Dec 19, 2021 at 11:26 PM Kai Ma <justksqsf at> wrote:

> I have opened an issue here [1], with modifications based on my experience
> of implementation.
> [1]
> Kai
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list