Stream: beginners

Topic: Importing nested modules?


view this post on Zulip Qqwy / Marten (Jul 08 2022 at 09:09):

So the JSON parser has grown to the size where I want to split it up in multiple files.
For instance:

- main.roc
- Parser/
    - Core.roc
    - Str.roc
    - Json.roc

To import Parser.Core from Parser.Str, I started writing the following:

interface Parser.Str
  exposes []
  imports [Parser.Core.{fail, const, alt}]

But this makes Roc search for a non-existent Parser/Parser/Core.roc file.
And trying to import Core makes the compiler complain that Parser/Core.roc is not named Core. (Actually triggering https://github.com/rtfeldman/roc/issues/3440)
Is there a different syntax I should be using here?

view this post on Zulip Richard Feldman (Jul 08 2022 at 11:16):

probably just a bug - I bet I know what it is, too

view this post on Zulip Richard Feldman (Jul 08 2022 at 11:16):

can you open a quick issue for it? Doesn't need steps to reproduce, just mention what you mentioned here

view this post on Zulip Qqwy / Marten (Jul 08 2022 at 11:46):

Done! https://github.com/rtfeldman/roc/issues/3451

view this post on Zulip Richard Feldman (Jul 08 2022 at 12:28):

thanks! I should be able to fix it today


Last updated: Jul 05 2025 at 12:14 UTC