Stream: ideas

Topic: LLM instructions to port old Roc code to the new compiler


view this post on Zulip Aurélien Geron (Jun 09 2026 at 22:49):

I'm working on porting the Exercism Roc track to the new compiler. So far I've done it by hand, but given the number of exercises, I'd like a bit of help from AI. For this, I've started to write a CLAUDE.md file describing how to port the code. It's done a decent job on a couple of exercises, but it's not perfect, I still need to intervene quite a lot (to be fair, I ask it to update Jinja 2 templates that generate Roc test code, so its task is not trivial). It takes care of basic syntactic changes fairly reliably (e.g., adding the curly braces) but sometimes it just doesn't know what to do, and I'm afraid it might generate non-idiomatic code for the new compiler.

Has someone else already worked on something like this? Maybe we could work on a good set of instructions to share. I searched in this forum and I found this interesting discussion on a related topic but it's more about writing new code, not really porting existing code.

Wdyt?

view this post on Zulip Romain Lepert (Jun 10 2026 at 09:00):

I think you could write the all_syntax_test.roc equivalent with the old roc syntax. Then give both to the agent and it will have a 1 to 1 translation for most common patterns and it should get you pretty far.

https://github.com/roc-lang/roc/blob/main/test/echo/all_syntax_test.roc

view this post on Zulip Anton (Jun 10 2026 at 11:55):

We actually already have an all syntax example for the old Roc: https://github.com/roc-lang/examples/blob/main/examples/AllSyntax/main.roc

view this post on Zulip Anton (Jun 10 2026 at 11:56):

And yes, telling Claude to compare both syntax examples for guidance would be my recommendation.

view this post on Zulip Luke Boswell (Jun 10 2026 at 13:25):

Has someone else already worked on something like this?

I've been porting examples over from the old syntax using Claude for each of my platforms as I've updated them. I feel like Claude has basically one-shotted all of the examples, or had a few iterations with roc check to correct for syntax errors.

I've been pointing Claude at the roc-lang/roc/test/ directory and saying something generic like "you can find examples for the new syntax in the tests and snapshots directory".


Last updated: Jun 16 2026 at 16:19 UTC