implicit def conv(foo: Integer => String): String => String => String = ??? def baadf00d(i: Integer): String = ??? def goodf00d: Integer => String = _ => ??? def deadbeef(foo: String => String => String) = ??? deadbeef(conv(baadf00d)) deadbeef(baadf00d)
The problem is how implicit conversions work on Scala and that there are exact and broken functions in Scala.
This is what SHOULD work, but not, and probably this is another compiler error (get ready to meet many others as you use Scala more and more).
EDIT: Regarding your last example
implicit def conv(foo: (Integer, Integer) => String): String => String => String = null def baadf00d(foo: Integer, bar: Integer): String = null def deadbeef(foo: String => String => String) = null
This is because function definitions exist. It is believed that the function (Int, Int) => String and the definition of the normal method (uneven) in scala, like how baadf00d defined, turns into this.
For example, the function:
def f(a: Int, b: Int): String
It turned into
(Int, Int) => String
Please note that 2 Ints are loaded! This is NOT the same as:
Int => Int => String
If you want to override baadf00d in:
def baadf00d: Integer => Integer => String = _ => _ => ???
This code will not compile because baadf00d is now โdifferentโ, although it does the same.
For more information, review the definition of objects:
Function1, Function2, Function3 ....
http://www.scala-lang.org/api/current/#scala.Function2