arrow-core-data / arrow.core / AndThen / andThen
fun <X> andThen(g: (B) -> X):
AndThen
<A, X>
Compose a function to be invoked after the current function is invoked.
import arrow.core.AndThen
import arrow.core.extensions.list.foldable.foldLeft
fun main(args: Array<String>) {
//sampleStart
val f = (0..10000).toList().foldLeft(AndThen { i: Int -> i + 1 }) { acc, _ ->
acc.andThen { it + 1 }
}
val result = f(0)
//sampleEnd
println("result = $result")
}
g
- function to apply on the result of this function.
Return a composed AndThen function that first applies this function to its input, and then applies g to the result.
Do you like Arrow?
✖