Verify yourself to prove that you are not a ROBOT! After verification the page will apear. Thanks for understanding.
I have some Scala code with type tags that I need to make available for Java users. My problem boils down to solving the following:
Given two Scala type tags, how can I manually create a type tag for Tuple2[ A , B ]?
If it makes any difference my specific case is a bit simpler:
I have one type tag for A and I need to create a type tag for Tuple2[ String , A ]
Type tags are usually used as implicits, so the implicit system is very familiar with them. Just tell Scala what type you want and ask for it implicitly.
def tupleTag[A : TypeTag, B: TypeTag]: TypeTag[Tuple2[A, B]] = implicitly
If it can be instantiated, Scala will do so. If it can't, it's a compiler error. In this case, since A and B are already concrete (in that they have tags), Tuple2[A, B] will always be concrete as well.