title: Why the compiler does not recognize the properties?
body: <p>I have the following code, that does not compile:  </p>
  
  <pre><code>sealed trait PcpPair
  
  case class PcpHead(key: String, value: String) extends PcpPair
  
  case class PcpFieldValue(field: String, value: String) extends PcpPair
  
    private val decodeHead: List[PcpHead] =&gt; String = heads =&gt;
      decodePair(heads) { (acc, value) =&gt;
        acc |+| value.key |+| ":" |+| value.value |+| "\n"
      }
  
    private val decodePair: List[PcpPair] =&gt; ((String, PcpPair) =&gt; String) =&gt; String = pcpList =&gt; fnPcp =&gt;
      pcpList.foldLeft("")(fnPcp)  
  </code></pre>
  
  <p>The compiler complains: </p>
  
  <pre><code> value key is not a member of com.sweetsoft.PcpPair
  [error]       acc |+| value.key |+| ":" |+| value.value |+| "\n" 
  </code></pre>
  
  <p>What am I doing wrong?</p>