Stream: ideas

Topic: Modules


view this post on Zulip nandi (Dec 29 2025 at 01:48):

In https://github.com/roc-lang/roc/pull/8787 @Luke Boswell mentioned there was a design decision to not have module. I'm confused what is meant by that.

view this post on Zulip Aidan Lavis (Dec 29 2025 at 01:57):

This thread / Google doc might be helpful: https://roc.zulipchat.com/#narrow/channel/304641-ideas/topic/static.20dispatch.20revisions/near/543083916

view this post on Zulip nandi (Dec 29 2025 at 02:07):

Richard Feldman said:

I wrote up some design ideas for improving static dispatch - feedback welcome! https://docs.google.com/document/d/12URaMmsgatVVwW-paKNWeCAsc862Cqp-npcUzqRk704/edit?usp=sharing

What's the status on this? is it decided or still in-process? Is there a decision platform like loomio or something that the core devs use?

view this post on Zulip Luke Boswell (Dec 29 2025 at 02:10):

I think the builtins moved into their own module Builtin.roc as an evolution from implementing this

view this post on Zulip Luke Boswell (Dec 29 2025 at 02:10):

Otherwise I think all of that is implemented

view this post on Zulip nandi (Dec 29 2025 at 03:07):

from experimentation it looks like currently the only way to import a module is putting it in platform folder, is that right?

view this post on Zulip Luke Boswell (Dec 29 2025 at 04:35):

Yeah I think we have a bug.

view this post on Zulip Luke Boswell (Dec 29 2025 at 04:35):

I just tried this

# Hello.roc
Hello := [].{

    say : () -> Str
    say = || {
        "Hello, World!"
    }
}
app [main!] { pf: platform "../platform/main.roc" }

import pf.Stdout
import Hello

main! = |_args| {
    Stdout.line!(Hello.say())
    Ok({})
}
$ roc examples/hello_world.roc
-- MODULE NOT FOUND ------------------------------

The module Hello was not found in this Roc project.

You're attempting to use this module here:
  ┌─ examples/hello_world.roc:4:1
  │
4 │ import Hello
  │ ^^^^^^^^^^^^

-- UNDEFINED VARIABLE ----------------------------

Nothing is named say in this scope.
Is there an import or exposing missing up-top?

  ┌─ examples/hello_world.roc:7:18
  │
7 │     Stdout.line!(Hello.say())
  │                  ^^^^^^^^^


Found 2 error(s) and 0 warning(s) for examples/hello_world.roc.

view this post on Zulip Luke Boswell (Dec 29 2025 at 04:49):

Ahk, I think this is due to roc check and roc build etc using different code paths.

view this post on Zulip nandi (Dec 29 2025 at 04:50):

Thats why i avoid both lol and just do roc <filename>

view this post on Zulip Luke Boswell (Dec 29 2025 at 05:14):

I'm going to have a crack at refactoring things a bit to fix this and re-enable some of those module tests

view this post on Zulip Luke Boswell (Dec 29 2025 at 07:27):

Made a start here https://github.com/roc-lang/roc/pull/8794

It needs a fair bit of cleanup. I want to re-enable a lot of the module tests first and get them working before I spend too much time polishing

view this post on Zulip Luke Boswell (Dec 29 2025 at 11:53):

Fixed the above in https://github.com/roc-lang/roc/pull/8794

Can someone have a look at that when they get a chance. :smiley:

view this post on Zulip Anthony Bullard (Dec 29 2025 at 14:41):

So It seems that this "Types as modules" thing is in the process of being landed already (well, ok, not already I just didn't see it for nearly 3 months :smile:)?


Last updated: Jun 16 2026 at 16:19 UTC