Would it be possible to add an ability to transform structural types to tuples and tuples to structural types?
trait Vehicle: val wheels: Int val range: Int
can be represented as
("wheels",Int,"range",Int ) // wheels - a literal type
Scala 3 gives a very powerfull tool to transform tuples:
type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match case EmptyTuple => Ys case x *: xs => x *: Concat[xs, Ys]
Unfortunately the match type cannot help to transform structural types currently.
Such feature will allow to use match types with structural types and it will be very usefull.