There is Either in scala which allow a variable to have 2 types value.
Either
val x: Either[String, Int] = Left(\"apple\")
However, I
Look at shapeless coproducts
"shapeless has a Coproduct type, a generalization of Scala's Either to an arbitrary number of choices"