Hi! I have the following Roc program:
app "hello"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.0/bkGby8jb0tmZYsy2hg1E_B2QrCgcSTxdUlHtETwm5m4.tar.br" }
imports [pf.Stdout]
provides [main] to pf
input = "hello\nworld"
dbg Str.split input "\n"
main =
Stdout.line input
I built it with nix build
in a clone of the roc repo, and when I run:
./result/bin/roc dev main.roc
I get:
── NOT END OF FILE ────────────────────────────────────────────────── main.roc ─
I expected to reach the end of the file, but got stuck here:
8│ dbg Str.split input "\n"
Any advice would be much appreciated
Does it work if you wrap them in braces dbg (Str.split input "\n")
Nope, nor does it work if I assign Str.split input "\n"
to a variable first and try to debug that variable
dbg
can only take one argument, and I guess the parser thinks this is passing a function and two strings to the dbg function
I guess you cant have dbg
as a top level statement
This works for me
input = "hello\nworld"
main =
dbg Str.split input "\n"
Stdout.line input
Ah that works for me as well! Thank you!
Lukas Hermann has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC