You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there is no way to get a TypeTag for a newtype:
@newtype caseclassWidgetId(toInt: Int)
valwidgetId=WidgetId(5)
importscala.reflect.runtime.universe._valtt= typeTag[WidgetId] // failed with No TypeTag available
WeakTypeTag works fine:
valwtt= weakTypeTag[WidgetId]
Also, I can get a TypeTag for the Repr type:
valrepr= typeTag[WidgetId.Repr]
Looks like there is no way to get a TypeTag for the newtype in the current newtype encoding because newtype's type is abstract, but TypeTag can be summoned only for a concrete type.
About my use case: I'm using doobie and it uses TypeTags very extensively for better logging and error reporting.
The text was updated successfully, but these errors were encountered:
Yeah, unfortunately I couldn't get the tmap/tcontramap variant working, so this workaround uses the regular map/contramap on doobie types. This works, but as @LMnet mentions, won't provide decent logging output when things go wrong.
Currently, there is no way to get a
TypeTag
for a newtype:WeakTypeTag
works fine:Also, I can get a
TypeTag
for theRepr
type:Looks like there is no way to get a
TypeTag
for the newtype in the current newtype encoding because newtype's type is abstract, but TypeTag can be summoned only for a concrete type.About my use case: I'm using doobie and it uses
TypeTag
s very extensively for better logging and error reporting.The text was updated successfully, but these errors were encountered: