Last active
January 31, 2023 12:52
-
-
Save frgomes/f66e6f7d13bdaeef5a262b0ffbe7d890 to your computer and use it in GitHub Desktop.
Scala: obtain ClassTag from TypeTag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import reflect.runtime.universe._ | |
import reflect.ClassTag | |
def typeTag2ClassTag[T: TypeTag]: ClassTag[T] = { | |
ClassTag[T]( typeTag[T].mirror.runtimeClass( typeTag[T].tpe ) ) | |
} |
Author
frgomes
commented
Jan 31, 2023
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment