one situation that came up in #roctoberfest > Show and Tell is that this doesn't work that way it looks like it would:
lines
|> List.map \line -> Str.split line ","
|> List.walk ...
this gets parsed as:
lines
|> List.map (\line -> Str.split line "," |> List.walk ...)
...because the parser doesn't have a reason to believe the \line -> lambda was supposed to have ended before the |> List.walk
however, we could change that
if we introduced a rule that lambda bodies had to be indented, then this would Just Work the way it looks like it would:
lines
|> List.map \line -> Str.split line ","
|> List.walk ...
that would be because |> List.walk is outdented relative to the beginning of the \line -> lambda, which would signal that the lambda had ended
I can think of some downsides to this design:
when)fn = \nums ->
List.map nums \num ->
num + 1
...because that would be a syntax error. Instead, you would have to indent the last line, like so:
fn = \nums ->
List.map nums \num ->
num + 1
granted, the latter is how the formatter would format it anyway today, but it's worth noting that neither of them would currently be a syntax error, whereas if we made lambdas require indentation, then only one of them would even parse
I'm curious what others think of this idea!
I am definitely pro indentation. I do it anyway for readability
I think this example is just worse form of backpassing. As such, i think if you want that tabbing, you should just use backpassing.
fn = \nums ->
List.map nums \num ->
num + 1
yeah I don't think there's a compelling reason to support that
it's more like "if someone writes it by accident, do they get a syntax error or does it Just Work and then the formatter indents it for them as a matter of style"
I consider it a very minor downside, but it is a downside nontheless :big_smile:
Yeah, backpassing seems to alleviate any downside to this proposal...
If we make bad indentation a syntax error here, then let's try to also mention the likely cause in the message
Pro-indentation!
To hell with those what want to bring named variables out of its scope!
For posterity (for anyone who finds these ideas threads and wonders which direction we went), could someone confirm if we made this change? It seems like we did, but I'm not sure.
It might be nice to have a one-liner "Accepted" or "Declined" or whatever when we come to a decision, in order to bring closure to the conversation ;)
Last updated: Jun 16 2026 at 16:19 UTC