Does Roc partially evaluate the parts of function bodies that work with comptime known parameters, or if there is at least one runtime param, the whole function becomes runtime-only?
For example:
add = |a, b| (a * 5) + b
add(1, getUserInput()?)
Is (a * 5) computed at comptime or runtime?
runtime, and it would still be comptime if add were curried...but you could get it to be comptime if you separated the arithmetic expressions like so:
add = |a| {
captured = a * 5
|b| captured + b
}
notramo has marked this topic as resolved.
Last updated: Nov 04 2026 at 18:54 UTC