You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the ReScript manual, a string "a" can be converted to char 'a' by .[0]
To convert a String to a Char, use "a".[0]. To convert a Char to a String, use String.make(1, 'a').
but the syntax is not working in ReScript.
>>>> Start compiling
bsb: [1/5] src/Test.ast
FAILED: src/Test.ast
Syntax error!
/home/cometkim/Workspace/tmp/rescript-template-test-8/src/Test.res:1:13
1 │ let a = "a".[0]
2 │
I'm not sure what to parse here when looking at "[". Syntax error! /home/cometkim/Workspace/tmp/rescript-template-test-8/src/Test.res:1:14 1 │ let a = "a".[0] 2 │ consecutive statements on a line must be separated by ';' or a newlinebsb: [2/5] src/App-MyRescriptApp.cmjFAILED: src/App-MyRescriptApp.cmj
I'm not sure it's a compiler bug or It is just a mistake. I'd like to update the docs to use String.unsafe_get instead.
The text was updated successfully, but these errors were encountered:
It's working on .re. I think it's a mistake while migrating docs from Reason. Is there a plan to support that syntax in the compiler? If so, Is it better to comment on it?
Sorry forgot about this. Fixed the docs now. We won't be exposing a dedicated sugar for Char, especially since it's a disrecommended type (no unicode/utf-8, doesn't make sense in JS, etc.). Thanks for the report!
According to the ReScript manual, a string
"a"
can be converted to char'a'
by.[0]
but the syntax is not working in ReScript.
I'm not sure it's a compiler bug or It is just a mistake. I'd like to update the docs to use
String.unsafe_get
instead.The text was updated successfully, but these errors were encountered: