In Scala, when is (A,A)=>R not equivalent to Function2 ?

Posted by Alex R on Stack Overflow See other posts from Stack Overflow or by Alex R
Published on 2010-04-27T00:06:30Z Indexed on 2010/04/27 0:13 UTC
Read the original article Hit count: 444

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?

© Stack Overflow or respective owner

Related posts about scala

Related posts about scala-2.8