Stream: contributing

Topic: Help Wanted : migrating the Roc Examples


view this post on Zulip Luke Boswell (Feb 27 2026 at 07:35):

Ok, I've merged this header-less app / echo platform into main.

I know of one bug #9208 but that should only come up in the rare case where we return an error tag with payload that has a custom implementation of Str.inspect.

The next step is migrating the examples in https://github.com/roc-lang/examples.

I'm thinking we make a branch, and keep them separate until we are happy to flick the switch and make the new zig compiler the default.

If anyone is interested in helping out this should be a nice self-contained set of tasks. Basically one PR per example.

For the examples that must use a platform like basic-cli/webserver, I think we can plan to move these to external example in those respective repos.

There is probably some research to dig out the latest syntax and test it out, but I guess that's why we are putting these examples together in the first place so other people can look it up in a friendly format. I'd highly recommend looking through the snapshot tests if you are unsure of what the correct syntax is for anything.

:smile:

view this post on Zulip Notification Bot (Feb 27 2026 at 07:36):

A message was moved here from #ideas > Roc Examples - migrate to "Headerless" Applications by Luke Boswell.

view this post on Zulip Norbert Hajagos (Feb 27 2026 at 09:38):

I'll gladly help with it. Probably avoid using ai (for fun), so I won't go as fast. Will go from bottom to top alphabetically, only "reserving" Tuples, TryOperatorDesugaring and TowerOfHanoi for now.

view this post on Zulip Anton (Feb 27 2026 at 09:41):

I think we can plan to move these to external example in those respective repos.

That can be a temporary measure, but I would like to avoid this longterm. One major benefit for the examples repo is that it is the centralized place for examples, so that people don't need to manually find the best platform(s) for their use case.

view this post on Zulip Tobias Steckenborn (Feb 27 2026 at 15:49):

Some way to get the web one to the headerless one, so that it's a bit more full fledged and you can demonstrate more with it?

view this post on Zulip Anton (Feb 27 2026 at 16:03):

Some way to get the web one to the headerless one

Can you be more specific? I'm not completely sure what you mean here.

view this post on Zulip Anton (Feb 27 2026 at 16:14):

For the echo platform, I have noticed that the build command is not yet supported:

❯ ./zig-out/bin/roc ./test/echo/hello.roc
Hello, World!

roc on  main is 📦 v0.0.1 via 🦀 via ↯ v0.15.2 took 3s
❯ ./zig-out/bin/roc build ./test/echo/hello.roc
-- NO PLATFORM FOUND -----------------------------

The app file ./test/echo/hello.roc does not specify a platform.

Add a platform to your app header, for example:
    app [main] { pf: platform "https://..." }

Is that just a bug?

view this post on Zulip Niclas Ahden (Feb 27 2026 at 16:14):

Anton said:

Some way to get the web one to the headerless one

Can you be more specific? I'm not completely sure what you mean here.

Guessing that Tobias is talking about https://github.com/roc-lang/roc-playground

view this post on Zulip Tobias Steckenborn (Feb 27 2026 at 16:19):

Yeah, sorry typed on the go. The playground right now lacks any output. Also there are errors in the samples (e.g. https://roc-lang.github.io/roc-playground/#content=YXBwIFttYWluIV0geyBwZjogcGxhdGZvcm0gImh0dHBzOi8vZ2l0aHViLmNvbS9sdWtld2lsbGlhbWJvc3dlbGwvcm9jLXBsYXRmb3JtLXRlbXBsYXRlLXppZy9yZWxlYXNlcy9kb3dubG9hZC8wLjYvMkJmR240TTl1V0pOaERWZU1naEdlWE5WREZpak1mUHNtbVZlbzZNNFFqS1gudGFyLnpzdCIgfQoKaW1wb3J0IHBmLlN0ZG91dAoKbWFpbiEgPSB8X2FyZ3N8IHsKICAgIFN0ZG91dC5saW5lISgiSGVsbG8sIFdvcmxkISIpCiAgICBPayh7fSkKfQ==)

If I understood it correctly the headless one might allow to echo into e.g. the dev tools console. So it might allow for better samples (and e.g. also some AOC tasks could eventually be solved with it just for getting a feeling for the language).

view this post on Zulip Anton (Feb 27 2026 at 16:39):

The next step is migrating the examples in https://github.com/roc-lang/examples.

I have created the examples branch new-compiler that uses the new Roc nightly for CI. You should use this branch as your base branch. Once you have ported an example, make sure to add it for CI like this.

view this post on Zulip Luke Boswell (Feb 27 2026 at 20:19):

@Tobias Steckenborn I descoped the WASM piece from this first PR... my goal was to unblock the examples migration.

It should be easier to wire into the playground now. I refactored the interface at the CLI. So now the cli doesn't have any special knowledge of the compiler internals, it's just calling a couple of functions.

Also this was the first thing we've implemented where we have a platform without a host (the cli is effectively the host and uses the compiler to JIT compile and run everything from memory. I've been calling this the "plugin" use case.

view this post on Zulip Luke Boswell (Feb 27 2026 at 21:01):

Anton said:

For the echo platform, I have noticed that the build command is not yet supported:

❯ ./zig-out/bin/roc ./test/echo/hello.roc
Hello, World!

roc on  main is 📦 v0.0.1 via 🦀 via ↯ v0.15.2 took 3s
❯ ./zig-out/bin/roc build ./test/echo/hello.roc
-- NO PLATFORM FOUND -----------------------------

The app file ./test/echo/hello.roc does not specify a platform.

Add a platform to your app header, for example:
    app [main] { pf: platform "https://..." }

Is that just a bug?

Not a bug, I totally didn't even think of it... :sweat_smile:

view this post on Zulip Luke Boswell (Feb 27 2026 at 21:03):

We can't support roc build for a header-less app, so we probably need to provide a helpful error message

view this post on Zulip Luke Boswell (Feb 27 2026 at 21:03):

The roc cli itself is the "host" -- there are no pre-built binaries.

view this post on Zulip Luke Boswell (Feb 27 2026 at 21:04):

Though we could support it if we wanted to, we would just need to pre-build the static libraries like a normal platform and embed those in the cli.

I'm not sure if that is the intended design for this feature. @Richard Feldman

view this post on Zulip Richard Feldman (Feb 28 2026 at 02:34):

yeah I think it's not worth it haha

view this post on Zulip Richard Feldman (Feb 28 2026 at 02:34):

we can just give an error message explaining that roc build only works on app modules (it also doesn't work on platform modules, package modules, etc.)

view this post on Zulip Anton (Feb 28 2026 at 09:55):

Luke Boswell said:

We can't support roc build for a header-less app, so we probably need to provide a helpful error message

#9219


Last updated: Mar 20 2026 at 12:28 UTC