Hey there,
I've got two files, src/main.roc
and src/OtherFile.roc
, running roc version
: roc nightly pre-release, built from commit a56d7ad on Fr 01 Dez 2023 09:08:29 UTC
.
It seems to want me to import pf.Path
, but then complains it isn't used if I do.
src/main.roc
:
app "import issue"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.0/bkGby8jb0tmZYsy2hg1E_B2QrCgcSTxdUlHtETwm5m4.tar.br" }
imports [pf.Stdout, pf.Task, OtherFile, pf.File]
provides [main] to pf
main =
result <- OtherFile.foo
Stdout.line "Result: \(result)"
src/OtherFile.roc
interface OtherFile
exposes [foo]
imports [pf.Stdout, pf.Path]
foo = \_anything ->
path = Path.fromStr "input.txt"
(Stdout.line "Trying to read '\(Path.display path)'")
So then if I add the pf.Path
import to src/main.roc
, I get a warning (?) telling me that Path
is not used in main.roc:
updated src/main.roc
:
app "import issue"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.0/bkGby8jb0tmZYsy2hg1E_B2QrCgcSTxdUlHtETwm5m4.tar.br" }
imports [pf.Stdout, pf.Task, pf.Path, OtherFile, pf.File]
provides [main] to pf
main =
result <- OtherFile.foo
Stdout.line "Result: \(result)"
Potentially related, if I remove pf.Task
import from main.roc
, I get the following MODULE NOT IMPORTEd error too:
I think If I use those imports in main.roc the warnings would go away, but it doesn't compile if I don't. What am I doing wrong?
This is a know bug.
Oh okay thanks!
Trying to find some links rn with extra context. I think that @Agus Zubiaga is working on a feature that revamps the import system and should fix this.
#ideas > module params has some info about the overarching feature change
Looks like a potentially large change to imports. Cool!
Yeah, I think Agus, is working on a full group at once, so may take a bit of time, but hopefully will cleanup this issues as part of the work.
Yeah, here’s the issue for this specific problem: https://github.com/roc-lang/roc/issues/5477
As Brendan said, most of these problems should go away as I rewrite big parts of the module system for that proposal implementation. It probably won’t be done this year, though :big_smile:
Last updated: Jul 06 2025 at 12:14 UTC