A closed generic algebraic data type for Bson serialization and deserialization in Scala