Hi!
I’m trying to write in code a string that when printed will output \a -> a
. Escaping the backslashes is proving challenging depending on the type of string literal I’m using, for example:
let f = "\\a -> a" // Fine, as expected
// Doesn't compile:
// [E] Line 6, column 9:
// Offset: 1, Invalid escape code: a
let f' = `\\a -> a`
let f'' = `\\\a -> a` // Triple backslash makes it work for some reason?
Is there a reason for this or a bug? I’d appreciate any help understanding how escaping works in the different string literals.
I try to default to backticks for literals in code due to the unicode support, but I’m not sure I understand the escaping rules now.
Thanks!