ARROW 2.0 IS HERE!!! - release highlights in video...
# arrow
a
ARROW 2.0 IS HERE!!! • release highlights in video

https://www.youtube.com/watch?v=2sfnDkPWoUw

• release announcement https://arrow-kt.io/community/blog/2024/12/05/arrow-2-0/
❤️ 11
arrow intensifies 26
🎉 9
K 1
m
What I noticed and missed so far: You should also mention in the release announcement, that the libraries were split up into specialised ones as you do in the video! Also,
arrow.fx.coroutines.Atomic
, changed quite a lot but I couldn't find any advice for migration! 😔 e.g.
unsafe
and
modify
weren't deprecated, but do not exist in 2.0. `unsafe`is easy as it can just be replaced by
invoke
. But
modify
doesn't look like it has a in place replacement. :-/
a
I definitely forgot atomic, but that transition happened some time ago... anyway, instead of
modify
you can use
getAndUpdate
https://apidocs.arrow-kt.io/arrow-atomic/arrow.atomic/get-and-update.html or
updateAndGet
https://apidocs.arrow-kt.io/arrow-atomic/arrow.atomic/update-and-get.html
m
sadly no... with `modify`it was possible to return any other type, which we made use of in that case. I fixed it by copying the original modify from 1.2.4 as a extension function to our code base.
Copy code
fun <A, B> Atomic<A>.modify(f: (A) -> Pair<A, B>): B {
    tailrec fun go(): B {
        val a = this.get()
        val (u, b) = f(a)
        return if (!this.compareAndSet(a, u)) go() else b
    }
    return go()
}