title: Is there a scala identity function?
body: <p>If I have something like a <code>List[Option[A]]</code> and I want to convert this into a <code>List[A]</code>, the standard way is to use <code>flatMap</code>:</p>
  
  <pre><code>scala&gt; val l = List(Some("Hello"), None, Some("World"))
  l: List[Option[java.lang.String]] = List(Some(Hello), None, Some(World))
  
  scala&gt; l.flatMap( o =&gt; o)
  res0: List[java.lang.String] = List(Hello, World)
  </code></pre>
  
  <p>Now <code>o =&gt; o</code> is just an identity function. I would have thought there'd be some way to do:</p>
  
  <pre><code>l.flatMap(Identity) //return a List[String]
  </code></pre>
  
  <p>However, I can't get this to work as you can't generify an <code>object</code>. I tried a few things to no avail; has anyone got something like this to work?</p>