Currently, you can't define types in a roc module that have the same name as a builtin type. For example, I can't have something like
interface F imports [] exposes []
Result o e : [Err e, Ok o]
because Result is already provided, by default, in every scope. Usually this is not a problem (why re-define Result?), but it can be a problem for more specialized types. For example, once we import Decode by default into every scope, this module will break. That is a more reasonable use case; rather than the generic Decoding interface, this module wants to expose a base64-specialized decoder
The question is, would it make sense for Roc to support a way to explicitly opt-out of default import of standard library types?
I am inclined to say "no", and that you should instead use names unique from the standard library (helps avoid ambiguity in the community, especially if we expect the standard library to be relatively small). In user space, name collisions will be resolved with package namespaces.
yeah agreed
The question is, would it make sense for Roc to support a way to explicitly opt-out of default import of standard library types?
implicit in the question is "would it make sense for Roc to support alternate stdlibs?" because they will definitely be created and advertised if it's possible to do this :big_smile:
I think for some languages, alternate stdlibs make a lot of sense, but I don't think Roc is one of those languages
Good point
For Elm, I've found it annoying that it automatically imports certain modules and types. That said, for me it was because I wanted to make my own replacement for Cmd and Sub and ended up having to use different names. Roc doesn't have any effects in its standard library so this is not a problem.
Hi, not sure if this is exactly the question asked, but one big selling point of Rust is nostd. It's one of the very few languages able to challenge C on that front. Having a way of limiting Roc std could be nice too?
Well the benefits of nostd iirc is that std does allocations and other things that aren't universal (like in embedded). Languages like zig have an allocator interface that mean std is completely applicable and there is no need for nostd. I think roc is in a similar situation where any effect goes through the platform and so you can just use Std in any environment.
Yeah, roc is pretty flexible in that sense. I have already run roc on a microcontroller where the platform was a nostd rust application. There are two main options for something like this:
roc_alloc. You will lose access to lists and strings, but otherwise everything works fine. Static compile time known lists and strings should still be fine.roc_alloc to pull from a limited pool of bytes like a static array. Then if roc uses over that much memory, you can decide how to handle it.I think roc could potentially handle this a bit more gracefully, but the general idea should work.
technically small strings work too, but you gotta be careful :sweat_smile:
Oh, and roc only supports 32bit and 64bit platforms. So that limits microcontroller options.
true, although in theory others are possible
For sure. Would be very interesting to see roc on an Arduino where the platform covers all of the core io and such.
Yea. Just plug in a zig buffer allocator and you're good to go.
Then you can apply what tigerbeetle does for their memory to roc. Allocate it all up front in zig and roc thinks it's requesting new memory when you already own it.
Yep. Totally doable in roc. You are just more likely to run into issues because it is harder to tracker your allocations and their sizes. Just more likely you will use more than you expect or incur accidental copies than with zig alone.
Last updated: Jun 16 2026 at 16:19 UTC