Stream: beginners

Topic: problem with backpasing


view this post on Zulip Artur Swiderski (Dec 09 2023 at 12:34):

hi I was under the impression that those should be equivalent

a = (  kk  <-  kk +1)
b = (\  kk  ->  kk +1)

but I get :

I am partway through parsing a record pattern, but I got stuck here:

126│ a = ( kk <- kk +1)
^

I was expecting to see a closing parenthesis next, so try adding a )
and see if that helps?

view this post on Zulip Kilian Vounckx (Dec 09 2023 at 12:39):

I think your understanding of backpassing is wrong.

foo \k ->
   k + 1

Is equivalent to

k <- foo
k + 1

So if the last argument of a (higher order) function is itself a function, it can be used with backpassing style

view this post on Zulip Kilian Vounckx (Dec 09 2023 at 12:40):

This can be used to avoid too much indentation, especially with await in tasks

view this post on Zulip Artur Swiderski (Dec 09 2023 at 12:57):

ok thx


Last updated: Jul 05 2025 at 12:14 UTC