title: Scala: recursive value listHuman needs type
body: <p>Why is this function giving me the following error:</p>
  
  <blockquote>
    <p>recursive value listHuman needs type</p>
  </blockquote>
  
  <pre><code>def setHumanResources(physicalResources: List[Physical], totalHumanResources: List[Human]): List[Human] = {
      val listHuman = physicalResources.map{pr =&gt; totalHumanResources.find(_.handles.contains(pr.post)).filterNot(a=&gt;listHuman.contains(a))}
      return listHuman
  }
  </code></pre>
  
  <p>I tried to do this, but it gives me another error:</p>
  
  <pre><code>val listHuman: List[Human] = physicalResources.map{pr =&gt; totalHumanResources.find(_.handles.contains(pr.post)).get}.filterNot(human=&gt;listHuman.contains(human))
  </code></pre>
  
  <blockquote>
    <p>forward reference extends over definition of value listHuman</p>
  </blockquote>