Hi everyone! I'm trying to do something like this ...
# arrow
p
Hi everyone! I'm trying to do something like this with only Arrow Core
Copy code
Option.fromNullable(nullableValue).mapNotNull(::f1).flatMap(::f2)
where f1 is
suspend (String) -> String?
and f2 is
suspend (String) -> Option(Whatever)
, is this supported?
s
Hey @pepe, This is support but Kotlin doesn't accept lambda references for
inline fun
even though it supports it. If you write the equivalent code below it'll work.
Copy code
Option.fromNullable(nullableValue).mapNotNull { f1(it) }.flatMap { f2(it) }
p
ah, I see, thanks. As a follow-up question, do you know if there's a KEEP or any intentions to support this in the future?
s
Don't think there is a KEEP actually but I've discussed it before in language proposals. They've improved/solved similar issues in the passed.