Does Roc support heredoc (multiline string)? It's really handy in other languages when you need to paste in a big string without worrying about escaping "
character.
It has multi line strings
""""This string
has multiple
lines
""""
Not exactly the same as heredoc because there's no special string at the start and end
Good to know, thanks! Do you know if this is documented anywhere? I couldn't find it in the tutorial or Str
module docs.
Looks like 3 quotes work, not 4: """
Roc also supports importing a file at compile time as a string
IngestFiles/main.roc here is an example that shows how to do that. Basically
imports [
"some-file" as someStr : Str,
"some-file" as someBytes : List U8,
]
Ryan Bates said:
Looks like 3 quotes work, not 4:
"""
Oh I meant to type 3! I was on mobile
@Luke Boswell wow I didn't know you could import a text file like this, it will save me a lot of code, thanks!
Last updated: Jul 06 2025 at 12:14 UTC