Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Parser] Multiline string #353

Closed
dariodsa opened this issue Nov 27, 2020 · 1 comment
Closed

[Parser] Multiline string #353

dariodsa opened this issue Nov 27, 2020 · 1 comment
Labels
question Further information is requested

Comments

@dariodsa
Copy link
Collaborator

Hi,
I am working on an issue #334 and I during testing of my code I step upon on some TOML example.

*Toml> Toml.encode (Toml.text "a") "\n"
"a = \"\\n\"\n"

This string is a multiline string and it should be followed and ended with triple quotes so I think that this shouldn't be parsed in TOML object. I don't am I missing anything with this example.

@chshersh chshersh added the question Further information is requested label Nov 30, 2020
@chshersh
Copy link
Contributor

@dariodsa The string you see is actually the result of applying Show instance to Text. If you print it to terminal, the TOML will look like this:

ghci> putStrLn "a = \"\\n\"\n"
a = "\n"

The TOML spec allows using escaped sequences in ordinary strings, including the \n symbol:

I think there exist multiple ways to format a string, but implementing those ways would complicate the logic significantly, so I think it's okay to have the single working version of encoding of strings 🙂

@dariodsa dariodsa closed this as completed Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants