In the past Arrow had function which worked like `...
# arrow
n
In the past Arrow had function which worked like
let
with multiple variables. I think it was called
zip()
. What happened to it? It is mentioned here https://stackoverflow.com/questions/35513636/multiple-variable-let-in-kotlin#comment124559417_35522422 but docs were moved and I can't find it.
a
what would be your requirements? in general
let
+ destructuring can get you a long way
Pair(3, "hello").let { (number, string) -> ... }
n
I was looking for something similar to your example but with null safety
a
one solution in this case is to use a
Raise
block, something like:
Copy code
fun Pair<A?, B?>.let(transform: (A, B) -> C): C? = nullable {
  val a = first.bind()
  val b = second.bind()
  transform(a, b)
}
n
doesn't
nullable
use exceptions to handle nullable variables?
a
the internals indeed use exceptions in a controlled way
👍 1
p
It may also be worth pointing out that
raise
uses untraced exceptions (that is, no stacktrace is populated at instantiation) unless explicitly requested via
traced {}
so in this case there is very little overhead to the exception usage within
nullable { }