In Scala, when is (A,A)=>R not equivalent to Function2 ?
- by Alex R
I'm trying to define and use my own foreach function.
This is in the middle of a larger block of code. But the essence of the error I'm getting is this:
test_2.scala:32: error: type mismatch;
 found   : (A, A) = Unit
 required: Function2
                $amount.foreach( (k:A,v:A) = { 
How is this error conceivably possible? Isn't (A, A) => Unit always a subtype of Function2 regardless of what else might be going on in the code?