Hi. Why comp
function is not resolved statically like compose
extension?
infix fun <A, B, C> ((B) -> C).compose(g: (A) -> B): (A) -> C =
{ x: A -> this(g(x)) }
fun <A, B, C>comp(f: (B) -> C): ((A) -> B) -> (A) -> C =
{ g -> { x -> f(g(x)) } }
val add = {a: Int -> {b: Int -> a + b }}
fun main() {
val f1 = add(2) compose add(2)
val f2 = comp(add(2))(add(2)) // error: Not enough information to infer type variable A
println(f1(0))
println(f2(0))
}