I'm confused about the imports.
I have a FooBar.roc file containing this code:
FooBar :: {}.{
square : a -> a
square = |x| { x * x }
cube : a -> a
cube = |x| { x * x * x }
}
And I have this test.roc file:
import FooBar exposing [square]
main! = |_arg| {
res = square(12)
echo!(res.to_str())
Ok({})
}
When I run test.roc, I get this error:
-- MODULE NOT FOUND ------------------------------
The module FooBar was not found in this Roc project.
You're attempting to use this module here:
┌─ /var/folders/74/7_g_vgn57nzgjh9mw5smp6rc0000gn/T/roc/debug-e8a08c1b/eA0BPcpNGwkobyfgh8wRPMuhj8Oc4veQ/main.roc:7:1
│
7 │ import FooBar exposing [square]
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-- UNDEFINED VARIABLE ----------------------------
Nothing is named square in this scope.
Is there an import or exposing missing up-top?
┌─ /var/folders/74/7_g_vgn57nzgjh9mw5smp6rc0000gn/T/roc/debug-e8a08c1b/eA0BPcpNGwkobyfgh8wRPMuhj8Oc4veQ/main.roc:10:11
│
10 │ res = square(12)
│ ^^^^^^
-- FILE NOT FOUND --------------------------------
/var/folders/74/7_g_vgn57nzgjh9mw5smp6rc0000gn/T/roc/debug-e8a08c1b/eA0BPcpNGwkobyfgh8wRPMuhj8Oc4veQ/FooBar.roc: FileNotFound
Found 3 error(s) and 0 warning(s) for /var/folders/74/7_g_vgn57nzgjh9mw5smp6rc0000gn/T/roc/debug-e8a08c1b/eA0BPcpNGwkobyfgh8wRPMuhj8Oc4veQ/main.roc.
I'm not sure what I did wrong. Any help would be greatly appreciated.
taking a look!
ok it turns out that @Aurélien Geron you're the first person to attempt importing modules in the new "default app" (with no platform) :joy:
they work when you have a platform but there's a bug that breaks importing for default apps - I'll have a fix soon
Oh cool, thanks @Richard Feldman!
I know it's early, but I've started looking at porting the Exercism Roc track to the new compiler. I don't expect it to be very hard overall, but many exercises depend on external modules, especially unicode, so those exercises at least will have to wait.
I just tested the code with a platform, and indeed it works just fine. :+1:
Note that I tried the following import, but it didn't compile (it said that square wasn't exposed):
import FooBar exposing [square]
I had to use this workaround:
import FooBar
square = FooBar.square
Is this working as intended?
Also, I had to replace a -> a with I64 -> I64 or else the compiler complained that x does not have a times method. I thought that Roc didn't force me to be precise in the type signatures?
yeah I found an unrelated exposing bug too - this PR addresses both!
Last updated: Jun 16 2026 at 16:19 UTC