title: Scala - Abstract type in constructors
body: <p>Consider the following code:</p>
  
  <pre><code>sealed trait SpecieType
  case class Mammal() extends SpecieType
  case class Insect() extends SpecieType
  
  abstract class Specie(name: String, specie: T) {
    type T &lt;: SpecieType
  }
  </code></pre>
  
  <p>However this fails to compile (line 5) because the abstract type is defined inside <code>Specie</code> class definition.</p>
  
  <p>What do I need to change to make this work?</p>
  
  <p>The reason why I needed an abstract type is because I need the type of its parameter at compile time (to perform implicit lookups for typeclass pattern). Basically, I need to do something like this: <code>implicitly[SomeTypeClass[Specie#T]]</code>, where <code>SomeTypeClass</code> is a typeclass that all subclass of <code>SpecieType</code> implements.</p>