Sumentyp Scala

sum type is generally (2.x) encoded as a:

sealed trait ProductType
object ProductType {
     case object Element1 extends ProductType
     case class Element2(field1: Type1) extends ProductType
     ...
     case class ElementN(field1: Type1) extends ProductType
}

- "sealed" -> protect against wild extension
- case in object for code organisation
Functional Platypus