kowainik / tomland

🏝 Bidirectional TOML serialization
https://kowainik.github.io/posts/2019-01-14-tomland
Mozilla Public License 2.0
120 stars 39 forks source link

[#408] Fix escaping #423

Open kukimik opened 1 year ago

kukimik commented 1 year ago

This should close #408. The extra \ was introduced by show. Along the way some other escaping issues introduced by the show "shortcut" are fixed (like improper escaping of control characters like \DEL, \NUL). Haskell escaping is not TOML escaping (the latter is much simpler, e.g. there is no need for a \&).

Caveats:

kukimik commented 1 year ago

Also, I didn't measure the performance. I'm not sure how Text concatenations are implemented, i.e. how many times the whole thing gets copied. Probably this can get meaningful when dealing with long strings. As a newbie I'm not really sure if it's better to use a Builder here, or with this amount of concatenation it is not worth it.