title: datatype of anonymous function vs named function in scala
body: <p>I am curious to understand the datatype of anonymous function in Scala(2.13.8).</p>
  <p>While reading Functional programming in Scala, I see below code</p>
  <pre><code>scala&gt; (x:Int,y:Int)=&gt; x&lt;y
  </code></pre>
  <p>As per the book, the output should be like below</p>
  <pre><code>res3: (Int,Int)=&gt; Boolean = &lt;Function2&gt;
  </code></pre>
  <p>But what I get is</p>
  <pre><code>val res3: (Int, Int) =&gt; Boolean = $Lambda$883/1341083542@7c871ce4
  </code></pre>
  <p>Below code also does not shows Function2 as type in result</p>
  <pre><code>scala&gt; val lessThan = (x:Int,y:Int)=&gt; x&lt;y
  val lessThan: (Int, Int) =&gt; Boolean = $Lambda$841/566447096@559e3f67
  </code></pre>
  <p>However, When I write the below code, I can see Function2 object is created</p>
  <pre><code>scala&gt; val lessThan2 = new Function2[Int,Int,Boolean] {
       | def apply(a:Int, b:Int)= a&lt;b }
  val lessThan2: (Int, Int) =&gt; Boolean = &lt;function2&gt;
  </code></pre>
  <p>My question is why in an anonymous function, I don't see datatype as Function2(as per the book page number 24, I should have seen it</p>