more generally, I’d be in favor of having a function that applies a side effect and returns its parameter, we could call it tap, I find it more flexible:
let tap = (x, f) => {
f(x)
x
}
let foo = "foo"->tap(Console.log)
more generally, I’d be in favor of having a function that applies a side effect and returns its parameter, we could call it tap, I find it more flexible:
let tap = (x, f) => {
f(x)
x
}
let foo = "foo"->tap(Console.log)