Open TWiStErRob opened 5 years ago
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) }
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.
Things like:
so we can do:
as if they were Kotlin function types