title: How did anonymous function implements the trait?
body: <p>let's see the code in scala REPL:
  first, i defined a trait:</p>
  
  <pre><code>trait Service{
    def invoke(name:String):String
  }
  </code></pre>
  
  <p>then i defined an anonymous function:</p>
  
  <pre><code>def serviceImpl:Service = (name)=&gt; s"Your name is $name"
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>the <code>serviceImpl</code> method returns an anonymous function --- "<code>(name)=&gt; s"Your name is $name"</code>" is just an instance of Function2[String, String] trait.</p>
  
  <p>but as above, how the anonymous function implements the Service trait?</p>
  
  <p>and How scala does this convert?</p>