Why doesn't Function2 have an andThen method?

function-composition, scala

Solution

I have just noticed it is easy to work around with the following:

val multiplyAndDouble = multiply.tupled andThen double
val res = multiplyAndDouble(1, 3) // res = 6

Problem

Why does `andThen` only exist for single argument functions in Scala? The following code works: ``` val double = (x: Int) => x * 2 val timesFour = double andThen double ``` But why is there no `andThen` method for multi argument functions? ``` val multiply = (x: Int, y: Int) => x * y val multiplyAndDouble = multiply andThen double <console>:10: error: value andThen is not a member of (Int, Int) => Int ``` Surely it is trivial to add this method. Is there a reason it been omitted from the standard library?

Original source

Related problems