Hello,
I am coming from nodes/js/ts environment and just stumble upon Roc.
I am sorry for being stupid, but I somehow cannot wrap my head about the relationship between core Roc lang and platform. How is it comparable to other languages where you typically have the lang itself, some standard library and various frameworks on top of that?
Also as I understand from few posts, Roc on its own cannot handle IO and is reliant on platform. Isn't it quite limiting to not have such important feature in the basic package? Is there some strong reason to have it this way?
G'day @Michal Timko , welcome :wave:
Have you seen this guide? https://www.roc-lang.org/platforms
I read through that.
It looks like platform is something like both external library and interface between Roc and another lang, that actually compile some executable from the code.
But the it raise another questions like if it doesn't make Roc just nice interface for Rust and what is possible to do with Roc without platform (can I even compile it to executable without platform?)
So for me is unclear what type of entity the platform is and what I can expect from it. But maybe when i try to build something, it will start making sense.
Yeah, I definitely recommend you try roc out. Maybe checkout the basic-cli and basic-webserver first. You could then also look at roc-wasm4 (a game platform), or one of the others.
My background is web developer, so my first intuition is "how to build server with this?"
And when I read a bit about platforms and the IO limitations, second question was "Can I build https server with this, if I need both web based api and IO in one platform?"
So I will see, what I can do.
@Michal Timko I think Roc's platforms make more explicit the relationship we have to lower level languages. The reason we use JS to write webservers is because we don't want to think about how to do stuff like manage memory or access resources, we want a PL that has done that adequately for us.
Roc functions as a language that is easy to write in and think about, and actively talks to someone else for the important stuff. But I'd rather write my logic in an easy language like Roc and have Rust do the hard stuff that needs to be done particularly and efficiently
JS doesn't go quite as far, but there are a lot of "performance critical" libs written in C that get wrapped in JS. Platforms work a similar way to that FFI
Shameless plug for my demo app https://github.com/lukewilliamboswell/roc-htmx-tailwindcss-demo
If you're coming from a web background, and looking for something to hack around with... you're welcome to play with that and if you want to make a PR with any features I'd be happy to review.
The goal of that demo is to be a good starting point for building web apps with roc, and demonstrate how to use familiar technologies like htmx and tailwindcss.
There's a lot more we could add in there, I just get distracted easily with other things :smiley:
Thank you,
will look into it.
Can I build https server with this, if I need both web based api and IO in one platform?
basic-webserver has both, it support for example File.write, Stdout.line and Http.get, ...
Yeah...I already realize it too. It just that in one speech Feldman mention something along the line that you probably don't need IO for web based apps, so I just assume that web oriented platforms are without IO...silly me.
Last updated: Jul 05 2025 at 12:14 UTC