Stream: ideas

Topic: ✔ Asymmetry between delimiter in fn declaration and calls?


view this post on Zulip Stuart Hinson (Nov 28 2023 at 15:00):

Very new to the language, so maybe my fresh eyes are helpful or misguided :smile: .

I tend to miswrite the following code

\x, y ->
  someOtherFn x y

without commas between the parameters

\x  y ->
  someOtherFn x y

ie with the intuition that params in the declaration should be delimited in the same way they are in function calls. Don't doubt there are good reasons the design decision was made, but thought I'd bring it up since it's been an issue for me.

view this post on Zulip Declan Joseph Maguire (Nov 28 2023 at 15:05):

There was very recently a thread about this. I'm literally about to go to sleep, so you'll have to dig for yourself, but reasons were provided.

view this post on Zulip Stuart Hinson (Nov 28 2023 at 15:26):

Declan Joseph Maguire said:

There was very recently a thread about this. I'm literally about to go to sleep, so you'll have to dig for yourself, but reasons were provided.

My bad! Search failed to turn it up. For posterity: https://roc.zulipchat.com/#narrow/stream/231634-beginners/topic/syntax.3A.20whitespace.20vs.20comma.20for.20items/near/402179415

view this post on Zulip Notification Bot (Nov 28 2023 at 15:26):

Stuart Hinson has marked this topic as resolved.

view this post on Zulip timotree (Nov 28 2023 at 15:41):

That thread talks about the possibility of removing commas from function types (f : a b -> c). Your question is about removing commas from function terms (f = \x y -> z). The observation in that thread was that having delimiters between argument types is nice when the argument types are complex to avoid parentheses (e.g. f : (Point a) b -> c). I don't think that same drawback really applies to argument patterns (e.g. f = \{x, y} z -> w)

view this post on Zulip Folkert de Vries (Nov 28 2023 at 15:57):

for arguments we chose to make those consistent with the type signature (so, commas always)

view this post on Zulip Brian Carroll (Nov 28 2023 at 18:27):

Maybe we should explain more about this in the error message, possibly as a link to the FAQ.


Last updated: Jun 16 2026 at 16:19 UTC