In the new compiler, it would be nice to treat the builtin modules as close to normal modules as possible to make compiling them simpler. One way to do that would be to save builtins into the Roc cache per Roc version, something like ~/.cache/roc/builtins/<version>/List.roc,Num.roc,etc.. This would pair with us saving results of a compiled file based on its hash and Roc version, meaning we don't need a special compiler pass that compiles builtins during compilation of our compiler. More valuable though would be builtins being available for "go to definition" for the LSP.
I'm not confident that we'll be able to make caching of builtin compilation work, but the LSP integration makes this seem worth it even without that.
We'd want to expose an archive of the builtins for each Roc version, I don't think we'd want to embed the builtins in the compiler or something like that.
We'd want to expose an archive of the builtins for each Roc version, I don't think we'd want to embed the builtins in the compiler or something like that.
Are you thinking there would be a separate folder that you would need to download when installing the compiler that would contain the builtins? Or that roc would download them at compile time like it does with platforms? I very much like that you only need the roc executable and nothing else.
Downloading them like is done with platforms might be fine, but it feels a bit strange that a freshly downloaded compiler wouldn't actually be able to run any programs without first downloading more things
In which case, it's probably best to include an archive in the compiler binary.
Which would incur a compilation cost on the first compilation, but it should be within like a millisecond or two, which I think is a fine cost to eat.
If we end up only wanting this for the LSP, the LSP could download them at startup
Yeah it seems like it would be fine to include them in the binary
Yeah, the biggest concern with caching is simply making sure the wiring to the stdlib still works with no hiccups.
The current builtins are 68kb in a .tar.gz archive
Wow, that's actually bigger than I expected
I expect Str.roc and List.roc are like half of that
But, we package llvm, so no size concerns here
Last updated: Jun 16 2026 at 16:19 UTC