You are trying to create Function2 (adder) using Function1, hence the problem. One way is to change the definition of Adder to a version with a map:
def adder(a: Int)(b: Int):Int = a + b
Then doubleAdd to partially apply the adder as follows:
def doubleAdd(x: Int) = doubler _ compose adder(x)
What happens under the hood converts the adder from Function2 (Int, Int) => Int to Function1 (Int) => (Int) => Int or a function that returns a function. Then you can compose the function returned from the adder, with the first parameter already applied.
Chris
source share