arrow-fx / arrow.fx / IO / redeem
fun <B> redeem(fe: (
Throwable
) -> B, fb: (A) -> B):
IO
<B>
Redeem an IO to an IO of B by resolving the error or mapping the value A to B.
import arrow.fx.IO
fun main(args: Array<String>) {
val result =
//sampleStart
IO.raiseError<Int>(RuntimeException("Hello from Error"))
.redeem({ e -> e.message ?: "" }, Int::toString)
//sampleEnd
println(result.unsafeRunSync())
}
Do you like Arrow?
✖