Is there a way in Scala 3 to use derives
keyword in combination with opaque type aliases?
It would be nice to have a boilerplate-free way to provide a typeclass instance to a given opaque type alias by automatically rely on the instance of the same type class for the underlying type (if any).
Would be nice to have the possibility of expressing something like
opaque type Id = Int
object Id:
given Show[Id] = Show.intShow
for some hypothetical typeclass Show
, as
opaque type Id = Int derives Show