You may not have heard, but if you are using latest, and you eager to move your projects to using snake_case identifiers - you can run
roc format --migrate
And the Roc formatter will make that change for you! Use it today and give feedback
I feel like it’s important to note that this DOES NOT know if something is a built in or a platform/package provided member - so if you are not creating a dependency free (or lite) package using a version of the compiler with snake_cased builtins (which doesn’t exist yet) - use this with caution. Luckily the ROC compiler has your back with the resulting errors
Thank you! Do you want feedback here?
Sure!
I can always move to bugs if needed
Screenshot_20241216_133249.png
I ran it on basic-cli@main, and it seems to ignore module [ ... ]
and exposes [ ... ]
references.
That’s Definitely a bug
Easy fix. I’ll do that after work
I've just ran it across my Roc platform code. I ran into the same cases that Jan did, but it also missed some other :camel: where I don't immediately see the pattern. There's examples of function definitions, function calls, string interpolations, and a couple more.
This is the roc code I ran the migration on. Easiest way to spot the problems after is to run roc check platform/main.roc
. Note the commit, because I'm doing some manual fixes. Nice that the migration already did a lot of the work!
https://github.com/jwoudenberg/jay/tree/14e8bbeb62cbbbbdedc46e7a9e7b13d50ff02aa0/platform
I will inspect and figure out the ast nodes I missed
I just ran this on Weaver and also saw a good number of nodes that weren't updated. Let me know if you want me to enumerate/make a GH issue or something
Sam Mohr said:
I just ran this on Weaver and also saw a good number of nodes that weren't updated. Let me know if you want me to enumerate/make a GH issue or something
Can you post the bad output to a branch and share a link?
https://github.com/smores56/weaver/tree/incomplete-snake-case-conversion
Thanks Sam!
This branch should fix 99% of the above.
https://github.com/gamebox/roc/tree/fix-snake-case-formatting
The only thing is does NOT try to differentiate between builtins and application members.
So this code will not be mergable _as is_ until the builtins and platform is updated as well
Looks like type args don't get consistently snake_cased:
module [truncate, CustomList]
CustomList my_item := List myItem
truncate : List myItem -> List *
truncate = \_my_items -> []
Pretty much everything else in Weaver got handled, though!
I’ll get to that. Feel free to create an issue and assign it to me
I created the issue @Sam Mohr ;-)
This issue has ended up being weirder than I expected. The same exact string _seems_ to be going into the same function, but sometimes it doesn't come out formatted?
This has required me to add snapshot tests for the formatted (with migrate on) snapshots
I wrote a unit test for it and of course it passes
What in the actual hell...
I'll have to look again tonight or tomorrow.
This is all in compiler code
kk, nvm I was looking at the CI failures on your other PR
Oh, did I hit a flake?
Last updated: Jul 26 2025 at 12:14 UTC