We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Things like:
inline operator fun Action0.invoke(): Unit = this.call() inline operator fun <T> Action1<T>.invoke(input: T): Unit = this.call(input) inline operator fun <T, R> Func1<in T, out R>.invoke(input: T): R = this.call(input) inline operator fun <T1, T2, R> Func2<in T1, in T2, out R>.invoke(input1: T1, input2: T2): R = this.call(input1, input2)
so we can do:
val block: Func1<in T, out R> val arg: T = ... val result: R = block(arg)
as if they were Kotlin function types
The text was updated successfully, but these errors were encountered:
Additionally these may be helpful:
inline fun (() -> Unit).toAction() = Action0 { this() } inline fun <T> ((T) -> Unit).toAction() = Action1<T> { this(it) } inline fun <T, R> ((T) -> R).toFunc() = Func1<T, R> { this(it) }
Sorry, something went wrong.
Do we even manually invoke these functional types that often? I'm struggling to see practical use cases here.
Also, I don't see value in those toAction() extensions since SAM handling takes care of lambda conversion for us.
Not in all cases, I'll show you examples when I get the chance. These all came from a need I had. We'll see if it makes sense.
No branches or pull requests
Things like:
so we can do:
as if they were Kotlin function types
The text was updated successfully, but these errors were encountered: