With the release of `0.11.0` (or `1.1.0-SNAPSHOT`)...
# arrow
d
With the release of
0.11.0
(or
1.1.0-SNAPSHOT
) is there any migration guide for what has changed (https://arrow-kt.io/docs/next/fx/ is not what I'm looking for, I am looking for a comparison of how things were done in previous releases versus
0.11.0
). Along with that, are there any actual code examples for the 0.11.0 / 1.1.0-SNAPSHOT releases? Again, I don't want https://arrow-kt.io/docs/next/fx/ as there are no code samples of how to do monad comprehensions, as an example. For example, take this example from @mattmoore’s blog post https://lambda.show/blog/arrow-io-monad-comprehensions-cleaner-monadic-composition... what's the equivalent syntax of this?
Copy code
fun getAddressFromOrder(orderId: Int) = IO.fx {
    val order = !getOrder(orderId)
    val customer = !getCustomer(order.customerId)
    val address = !getAddress(customer.addressId)
    address
}
s
The equivalent syntax would be.
Copy code
suspend fun getAddressFromOrder(orderId: Int) {
    val order = getOrder(orderId)
    val customer = getCustomer(order.customerId)
    val address = getAddress(customer.addressId)
    address
}
Where
IO
is replaced with
suspend
. This opens the door to easily combine
IO
operations with other monads such as
either
without having to use monad transformers. You can now simply use a
Either.fx
rebuild as
either
block, inside
suspend
which previously ot possible. You'd have to use
EitherT<ForIO
to achieve similar behavior which has a much steeper learning curve. Since suspend offers the same guarantees as
IO
, and thus the same combinators can be implemented we want to promote this since it's much more Kotlin idomatic and offers a way forward for easy FP in Kotlin with a much smaller learning curve. The link that @PhBastiani shared was the document written to propose
suspend
over
IO
, if you're missing some of this information on the Arrow website a PR would be greatly appreciated 🙏
d
thanks @simon.vergauwen that's very helpful!