-
Notifications
You must be signed in to change notification settings - Fork 89
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
Show String outputs illegal escape sequence \& in string literals #258
Comments
I discovered this while experimenting with the PureScript plugin for IntelliJ and comparing its syntax highlighting with the behavior of the PureScript compiler/REPL. Unfortunately I could not find any documentation on the escape sequences which PureScript supports. At least not in the sections on Syntax and Differences from Haskell. The only source of truth here is the source code of the PureScript compiler itself. This lack of documentation seems to have caused some confusion in PureScript itself and even more so in the IntelliJ plugin. I can prepare a pull request for the documentation, so other can benefit from what I learned. |
I can confirm this still affects 0.14. Interestingly, it doesn't affect type-level symbols (at least in 0.14): > "\x0000001"
"\0\&1"
> "\x000001"
"\1"
> data SProxy (s :: Symbol) = SProxy
> :t SProxy :: SProxy "\x0000001"
SProxy "\x0000001"
> :t SProxy :: SProxy "\x000001"
SProxy "\x000001"
> :t SProxy :: SProxy "\x00001"
SProxy "\x000001" I'm not familiar enough with the pretty printer to diagnose/fix this. |
Wait. I just realized that this is an issue with the purescript-prelude/src/Data/Show.js Lines 29 to 51 in 898f35a
We should probably update it to match the compiler's output though though. |
Okay, I transferred it to the prelude from the compiler repo. |
Thanks for the quick response! I looked into this more closely in the meantime and realized the scope of the bug report was probably too narrow. It was not just the I cannot tell which other code would be affected by this change to the prelude. I would however prefer that the REPL pretty-printed string and char literals using PureScript escape sequences. |
Correct me if I'm wrong but is |
Here's another place where a breaking change can be done now. How do we fix this? |
Description
The REPL outputs string literals containing the escape sequence
\&
but this escape sequence is not accepted as input.To Reproduce
In the REPL:
Expected behavior
The REPL outputs valid string literals.
Additional context
Haskell supports
\&
to delimit a numeric escape sequence from the following characters, see The zero-width escape sequence. This is exactly the way in which the PureScript REPL uses\&
to produce canonicalized string literals. However the compiler does not actually accept this escape sequence. If it did this would provide a solution to the problem in purescript/purescript#3750.PureScript version
0.13.8
The text was updated successfully, but these errors were encountered: