After I ran the <migration script>, there was 1 th...
# arrow
s
After I ran the migration script, there was 1 thing that wasn’t automatically fixable in my codebase, and that was the Option has a function with the signature
public suspend fun <B> Option<B>.bind(shift: () -> R): B
but with the new Raise scope nothing exists. My use case was that I was basically doing
Copy code
someList.firstOrNone { it.someCheck }.bind { ErrorType }
and there was nothing that the IDE could help me with, it was simply red in this case. I’ll simply move over to using firstOrNull and deal with the null type with a simple
ensureNotNull
instead of getting an Option in the first place, but just thought I’d let you know of this edge case. Not sure if you want to have things to cover all cases, so just writing this here so you know 😊
s
Hey @Stylianos Gakis,
bind { }
has been replaced by
getOrElse { }
, after I started working on https://github.com/arrow-kt/rewrite-arrow I kind-of abandoned that script.
I'm not sure if that is covered yet in the
RaiseRefactor
recipe yet 🤔 I've been extremely busy in the two weeks after KotlinConf 🤕
s
Ah yes getOrElse would work too, thanks about that. Yes, I just shared this to let you know. Don't want to rush you, I understand you're busy 😊 Our migration was incredibly painless, as I said only this 1 thing I had to manually do something, so no worries on our end, and thanks so much for all the incredible work!