title: Create a collection of case class names
body: <p>I'm working in Spark 3.1 with Scala 2.12.10.</p>
  <p>I'd like to create a collection (Seq, whatever) of case classes that have implemented a common trait, so I can execute some generic dataset code on the collection members without having to type each incantation separately. I <em>think</em> I can get the erased type via TypeTag, but I'm unable to define the collection in the first place!</p>
  <p>Given these types:</p>
  <pre><code>trait HasID { val id: String }
  
  case class Customer(id: String, name: String) extends HasID
  case class Product(id: String, desc: Int) extends HasID
  case class Sale(id: String, value: Float) extends HasID 
  
  class Appender[T &lt;: HasID : Encoder] { ... } // dataset methods
  </code></pre>
  <p>I can call the code:</p>
  <pre><code>new Appender[Customer]() ...
  new Appender[Product]() ...
  new Appender[Sale]() ...
  </code></pre>
  <p>But what I want is to put the classes in a collection and loop through it:</p>
  <pre><code>Seq[HasID](Customer, Product, Sale).foreach(c =&gt;
    // get type C of c somehow
    new Appender[C]() ...
  )
  </code></pre>