hey folks! in elixir's typespec we can optionally name arguments for documentation purposes. this doesn't change the function in any way, we can't pass them in random order or anything.
since Roc is a language that will possibly be pipeline-heavy (which means we will probably have functions with multiple arguments instead of receiving a record) maybe it would also benefit from this feature?
while trying to write an example I ended up hating the result :joy: but I thought it might be worth the discussion anyway.
in elixir it would look something like:
@spec parse_string(input :: String, pattern :: String) :: List token
in Roc (idk):
parseString : input :: String -> pattern :: String -> List Token
I think it would be nice if those names could be populated from the parameters the implementation expects, rather than having to type them again in a type signature
There was some discussion about this in this issue: https://github.com/roc-lang/roc/issues/4301
yep! that would be a lot better
Last updated: Jun 16 2026 at 16:19 UTC