Stream: ideas

Topic: separate modules for effects


view this post on Zulip Richard Feldman (Jan 25 2022 at 03:39):

wrote up an idea I talked about with @Folkert de Vries the other day - feedback welcome!

https://github.com/rtfeldman/roc/issues/2405

(probably easiest to discuss feedback here instead of in the comments there, just to keep it in one place)

view this post on Zulip Lucas Rosa (Jan 25 2022 at 03:59):

I like that, it feels better than a magical fx

view this post on Zulip Lucas Rosa (Jan 25 2022 at 04:00):

maybe I didn't mean to say magical. But what the proposal suggests seems to fit together nicely with the language and it feels pretty natural to have it as a module with a special header

view this post on Zulip jan kili (Jan 25 2022 at 05:02):

Why is a dedicated Effect module necessary at all? Can Effect just be a builtin type that any function can use, and then the platform's effects can just be defined in any (or multiple/all) of the platform's modules and exposed normally?

view this post on Zulip jan kili (Jan 25 2022 at 05:03):

I guess I don't understand the original purpose of the effects fx.Effect block.

view this post on Zulip jan kili (Jan 25 2022 at 05:04):

I like this proposal, and I'm curious if we can take it even farther/simpler :smile:

view this post on Zulip Lucas Rosa (Jan 25 2022 at 17:48):

JanCVanB said:

Why is a dedicated Effect module necessary at all? Can Effect just be a builtin type that any function can use, and then the platform's effects can just be defined in any (or multiple/all) of the platform's modules and exposed normally?

that's how it is now

view this post on Zulip Lucas Rosa (Jan 25 2022 at 17:49):

you access that builtin via fx.

view this post on Zulip Lucas Rosa (Jan 25 2022 at 17:50):

JanCVanB said:

I guess I don't understand the original purpose of the effects fx.Effect block.

so that we know which platform functions to map to. On the platform side things defined in that block can be found with a name like roc_fx_nameOfFunction

view this post on Zulip jan kili (Jan 25 2022 at 17:52):

Gotcha, thanks!


Last updated: Jun 16 2026 at 16:19 UTC