Stream: ideas

Topic: Universal apps


view this post on Zulip Peter (Jul 18 2022 at 19:23):

Has anyone explored the idea of making universal apps in Roc. These are single programs which execute in more than one place. I.e. a single program describing a server and client. The first place I saw this was https://github.com/blitz-js/blitz
I've had a go implementing this in my language and it didn't take too much effort. However my language is very feature limited and makes it pretty safe to pass code around by being pure by construction.
I don't quite know what a Roc solution would look like, but I think we roc making the platform layer explicit it could be interesting. Is there a way for a Roc platform to check that it is compatible with another platform

view this post on Zulip Martin Stewart (Jul 18 2022 at 19:32):

The first thing that comes to mind is https://www.lamdera.com/. It's written in Elm instead of Roc but given that languages are quite similar I think it could be a good reference when considering something like this for Roc.

view this post on Zulip Peter (Jul 18 2022 at 19:40):

It's a shame that lamdera is a service. I'd like to just have a built program I could deploy myself. I don't know if the lambdera model requires it too be a service

view this post on Zulip Martin Stewart (Jul 18 2022 at 19:46):

I believe the reason for it being a service is that it lets Lamdera manage the hosting which in turn means deploying to production requires almost no configuration (just an app name and SSH public key). If Lamdera wasn't a service and you could deploy wherever, that would probably bring in a lot more complexity.

view this post on Zulip Qqwy / Marten (Jul 18 2022 at 21:13):

Declarative programming lends itself very well for this, in that you only program your declarative structure once, and then can re-use it in multiple contexts for multiple purposes.

view this post on Zulip Qqwy / Marten (Jul 18 2022 at 21:14):

The first thing that comes to mind is of course logic programming languages like Prolog. It excels in these kinds of things, although the tooling and guidance around Prolog are a rather lackluster

view this post on Zulip Qqwy / Marten (Jul 18 2022 at 21:15):

That said, we should implement a (mini)Kanren for Roc at some point! (It is 'logic programming as a library')

view this post on Zulip Qqwy / Marten (Jul 18 2022 at 21:18):

The HTTP tooling in Roc is still in active development and heavily in flux, but it definitely will be possible to create a higher level abstraction on top so you could have a generalized "API builder" DSL. The built datastructure you could then re-use for both your client and server.

view this post on Zulip Peter (Jul 25 2022 at 18:18):

Ok so I had a crack at implementing something myself. https://vimeo.com/733332434
I like the interface but I've no idea how one would make it fast


Last updated: Jun 16 2026 at 16:19 UTC