found this in the docs about using the familiar js template string tick marks for handling unicode: Primitive Types | ReScript Language Manual
I also see this post from September about v9 saying it would be fixed in next release: Unicode support in pattern matching
I’m using v10.1.0, does rescript not support pattern matching using switch on non-ascii literals?
see example test below
open Jest
open Expect
describe("switch works on non-ascii literals?", () => {
let description = token =>
switch token {
| "A" => "the letter A"
| `👍` => "a thumbs up"
| "👎" => "a thumbs down"
| _ => "i don't know"
}
test("emoji literal equals emoji literal", () => {
expect(`👍`)->toEqual(`👍`)
})
test("matches ascii literal", () => {
expect("A"->description)->toEqual("the letter A")
})
test("matches unicode literal using tick marks", () => {
expect(`👍`->description)->toEqual("a thumbs up")
})
test("matches unicode literal using double quotes", () => {
expect("👎"->description)->toEqual("a thumbs down")
})
test("non matching ascii literal", () => {
expect("B"->description)->toEqual("i don't know")
})
})