title: no type parameters for method flatMap
body: <p>I don't know why the following code can not compile, this is the error message:</p>
  
  <blockquote>
    <p>Error:(29, 7) no type parameters for method flatMap: (f: String => Option[B])Option[B] exist so that it can be applied to arguments (String => Some[Class[?0]] forSome { type ?0 &lt;: org.apache.hadoop.io.compress.CompressionCodec })<br>
         --- because ---<br>
        argument expression's type is not compatible with formal parameter type;
         found   : String => Some[Class[?0]] forSome { type ?0 &lt;: org.apache.hadoop.io.compress.CompressionCodec }<br>
         required: String => Option[?B]<br>
            a.flatMap(codecClassName => {<br>
              ^</p>
  </blockquote>
  
  <p>and code</p>
  
  <pre><code>  def f(a: Option[String]): Unit = {
      a.flatMap(codecClassName =&gt; {
        val codecFactory = new CompressionCodecFactory(new Configuration())
        val codecClass = codecFactory.getCodecClassByName(codecClassName)
        if (codecClass == null) {
          throw new RuntimeException("Unknown or not supported codec:" + codecClassName)
        }
        Some(codecClass)
      })
    }
  </code></pre>