use
syntax sugar
The use
keyword is a syntax sugar used to avoid deeply nested callbacks.
For example:
{
use a, b <- f(x, y)
expr1;
expr2
}
Desugars to:
f(x, y, fn a, b {
expr1;
expr2
})
It can be used with 0-n args:
use <- f()
use a <- f()
use a, b, c <- f()
The use
syntax is only accepted inside blocks.
use
is inspired by Roc's backpassing syntax and Gleam's use operator.