Stream: beginners

Topic: Type module which depends on a type defined within?


view this post on Zulip Ian McLerran (May 30 2026 at 19:49):

In the new compiler, is there any way to define a Type module, who's nominal type depends on another type, also defined within that module file?

IE:

## ModuleType.roc
ModuleType := {
     field : InternalType,
}.{
    InternalType := [Some, Other]
}

view this post on Zulip Richard Feldman (May 30 2026 at 20:32):

I'd expect this to work if you put the other type at the top level too

view this post on Zulip Richard Feldman (May 30 2026 at 20:33):

although I can't think of a reason why this couldn't be allowed as-is :thinking:

view this post on Zulip Richard Feldman (May 30 2026 at 20:33):

can you open an issue for that?

view this post on Zulip Ian McLerran (May 30 2026 at 20:35):

Currently doesn't work either way. Shall I open a single issue for both?

view this post on Zulip Richard Feldman (May 30 2026 at 20:51):

sure, thanks!

view this post on Zulip Richard Feldman (May 31 2026 at 02:13):

oh also I think it might work better on current main (not sure if you were on an older version?) - anyway here is a PR improving things! https://github.com/roc-lang/roc/pull/9490

view this post on Zulip Richard Feldman (May 31 2026 at 02:13):

(I don't think we need an issue after all haha)

view this post on Zulip Richard Feldman (May 31 2026 at 02:14):

thanks for reporting it!

view this post on Zulip Ian McLerran (May 31 2026 at 02:17):

Oh, haha! Already filed the issue! :sweat_smile:


Last updated: Jun 16 2026 at 16:19 UTC