Is there an stdout function that prints multiple lines? or just the line! one?
Just the line one for now
You could write one that wraps that
oh there is no multiline string yet in the new roc?
input =
"""
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82
"""
print! = |msg| {
for line in msg.split_on("\n") {
Stdout.line!(line)
}
}
main! = |_args| {
Stderr.line!("Hello")
dbg input.trim()
print!(input.trim())
Ok({})
}
This produces no dbg output
multiline strings use double backslash \\
input =
\\1 2
\\3 4
\\5 6
Thanks! will be worth adding to Richard gist I think!
I’ve removed my debug statement, and the program seems to still be trying to do some debug that creates an error:
❯ roc day01.roc
Hello
L68
L30
R48
L5
R60
L55
L1
L99
R14
L82
error(gpa): memory address 0x1032c0040 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo
error(gpa): memory address 0x1032c0080 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo
Is this an error I should try to minify and create an issue?
It seems the memory leak is detected as soon as I add the 7th line in my multiline string.
input =
\\L68
\\L30
\\R48
\\L5
\\R60
\\L55
\\L1 # <- memory leak triggers here
#\\L99
#\\R14
#\\L82
print! = |msg| {
for line in msg.split_on("\n") {
Stdout.line!(line)
}
}
main! = |_args| {
#Stderr.line!("Hello")
#dbg input
print!(input.trim())
Ok({})
}
I opened an issue with it: https://github.com/roc-lang/roc/issues/8525
Fixed in https://github.com/roc-lang/roc/pull/8527
Last updated: Dec 21 2025 at 12:15 UTC