I have some ideas about how to handle this but I haven't figured out the right way yet
one idea is:
System.target! which returns some system infoLinux argument, which means you can only call them if you got one of those values from the tag union, which in turn means you're running on Linuxthe reason I'd do it as an effectful function (System.target!) is that we currently have the invariant that if you call a Roc pure function passing the same arguments, you are guaranteed to get the same answer no matter what target you're building for. I wouldn't want to sacrifice that invariant just to make this operation callable in more places, especially when the reason you'd use it would be to unlock calling effectful functions from your platform anyway.
but of course if it's going to be an effectful function, it doesn't need to be a builtin; any platform can just offer an effectful function like that today
or, alternatively, pass the target info into main! along with env etc. - that has the downside that application authors would need to thread it through more places, but there are other tradeoffs to doing it that way.
anyway, so I don't know whether it will someday make sense to do that as a builtin, but certainly for right now there's nothing stopping any platform from doing that today, so that's what I'd recommend!
happy to explain any of the details there
Thanks, this seems to be a good solution without changing the language.
I agree with the platform check function being effectful.
notramo has marked this topic as resolved.
Last updated: Oct 15 2026 at 17:56 UTC