For Advent of Code I wanted to name a file 2022_01.roc but I can't figure out how to import it. Even adding a letter at the front it still doesn't like the underscore. Is it impossible to use a filename like this with Roc?
I'm not aware of any restrictions, I had a look through the tutorial and guide for elm programmers too. I'm guessing it may something related to the naming convention for defs. I notice in the tutorial that for defs
You can name a def using any combination of letters and numbers, but they have to start with a letter.
ah! Modules you can import need to start with a capital letter. This is so that the compiler can tell the difference between Foo.bar
(look for bar
to be exposed from a module named Foo
) and foo.bar
(look for a record field bar
on a variable named foo
)
I'll make a note to add that to the tutorial!
Last updated: Jul 06 2025 at 12:14 UTC