Danilo Herrera
05/23/2019, 3:09 PMTry of different types into a Try of a third type?
fun a(): Try<Int> = Try { 5 }
fun b(): Try<String> = Try { "Hello" }
fun c(): Try<Float> =
a()
.map {
it.toFloat() / b().fold({ throw RuntimeException() }, { it.length })
}
I shouldn't need to call fold for this, right?