Just my 2 cents...personally I don't favor backpassing for non-IO (Task) due to the indentation change. E.g. glancing below, it feels like the last line is the return value (instead of of List Str)
result =
x <- nums |> List.map
Num.toStr x
The old fashion way is cleaner keeping the lambda closer to List.map
result =
nums |> List.map \x -> Num.toStr x
It definitely can read weird at times. Though works great with Result.try
for example
I probably use it too much personally.
also we can only do one backpassing block at a time, right? because the lambda body now takes that indentation
Brendan Hansknecht said:
It definitely can read weird at times. Though works great with
Result.try
for example
because Result.try is a typical Monad (with my limited Haskell understanding). so it works naturally with the backpassing style (do-notation in Haskell)
Just trying to point out that it works with more than just io. It works with anything monad like. Random number generation can also be nice for this.
Yes, one block at a time due to indentation.
Though you can always do:
task =
x <- ...
y <- ...
...
# continue on outside of that scope
So one level of indentation for a whole chain of calls
gotcha. the callback chains can be one block
Steven Chen has marked this topic as resolved.
Last updated: Jul 06 2025 at 12:14 UTC