I have a few questions on how platforms work. From my understanding a platform is the only way a Roc app can have external side effects. I like the concept and think tasks with backpassing are an ingenious solution to handling side effects in a functional way. However relying on a single platform seems limiting.
Is a rock app limited to one platform? What if I need to communicate with a database or external API, does the platform need to support that directly? What if I need PostgreSQL, MongoDB, Redis and Memcached all in one app? Having one platform match all of those requirements doesn't seem flexible.
Some general reading is at roc-lang.org/platforms
Quick answers to all of the questions:
Is a rock app limited to one platform?
yes.
What if I need to communicate with a database or external API, does the platform need to support that directly?
The hope is that the platforms can support a generic TCP and HTTP primitives and the rest can be built in roc. This will enable a lot of sharing.
What if I need PostgreSQL, MongoDB, Redis and Memcached all in one app?
There is already roc-pg
that enables using Postgress just over TCP. the same could be done for all of those databases.
Having one platform match all of those requirements doesn't seem flexible.
I think for a number of use cases it will be common to just build a custom platform for the application. Maybe start with something more generic, but tune it to the specific extras of a use case.
there's a design (currently being implemented) for how to have platform-agnostic effects!
Thanks for the replies, glad to know this is addressed. :smiley:
Where can we find roc-pg
?
nvm: https://github.com/agu-z/roc-pg
Last updated: Jul 06 2025 at 12:14 UTC