arrow-core-data / arrow.core / AndThen / invoke
open fun invoke(a: A): B
Invoke the [AndThen]
function
import arrow.core.AndThen
fun main(args: Array<String>) {
//sampleStart
val f: AndThen<Int, String> = AndThen(Int::toString)
val result = f.invoke(0)
//sampleEnd
println("result = $result")
}
a
- value to invoke function with
Return result of type B.
operator fun <A, B> invoke(f: (A) -> B):
AndThen
<A, B>
Wraps a function in AndThen.
import arrow.core.AndThen
fun main(args: Array<String>) {
//sampleStart
val f = AndThen { x: Int -> x + 1 }
val result = f(0)
//sampleEnd
println("result = $result")
}
f
- the function to wrap
Return wrapped function f.
Do you like Arrow?
✖