Multiple Roc Files

You can use modules to organize your code into multiple files.

Code

Hello.roc:

module
    # Only what's listed here is accessible/exposed to other modules
    [hello]

hello : Str -> Str
hello = \name ->
    "Hello $(name) from interface!"

main.roc:

app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }

import pf.Stdout
import Hello

main =
    Stdout.line! (Hello.hello "World")

Output

Run this from the directory that has main.roc in it:

$ roc main.roc
Hello World from interface!