Serializable(or similarly Productor both together) is almost always a sign that you are trying to consider two types as the same when they are not. For instance:
scala> if (true) "a" else List(1)
res0: java.io.Serializable = a
- .. , . String a List[Int], AnyRef, , Serializable. , Serializable , , AnyRef, .
:
scala> List("a", "b", "c", 'd)
res1: List[java.io.Serializable] = List(a, b, c, 'd)
, , Serializable, - , .
pathxml | num Parser[RDDThing] Parser[Float \/ RDDThing], Parser[Serializable]. , pathxml factor2 pathxml.map(_.right) | num.