There is any docs where I can read on how to spleet a code in mutliple file?
I'm not sure about docs, but you can split code into different modules and then just import them. I use this in my AoC where I have a Parser.roc which I import. For putting things in folders e.g. Internal, you then import them with imports [ Internal.Parser.{ Parser } ]
for example.
Luke Boswell said:
I'm not sure about docs, but you can split code into different modules and then just import them. I use this in my AoC where I have a Parser.roc which I import. For putting things in folders e.g. Internal, you then import them with
imports [ Internal.Parser.{ Parser } ]
for example.
mh! so if I had a file called cli and inside the file there is an export function caller parse, the import is like imports [cli.{parse}]
?
or the name of the module that I need to import need to start with an upper letter?
I think uppercase might be required
Is there a way to do the opposite? Have essentially a submodule / namespace in the same file? I wanted to build a "Grid" module with specific types and functions defined within the same "08.roc" file.
I don't think that is possible currently
The closest you could get would be a struct with a bunch of lambdas in it.
That would kinda be "namespacing", but definitely not the same
Last updated: Jul 05 2025 at 12:14 UTC