How to construct a structural type via metaprogramming? #14056
-
If I have Foo[T] {
val bar : Int
val baz : String
} ? And this is just an example. Obviously I want to be able to control how many fields, their names and types. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
You need to use the Here is a prototype macro that converts a tuple |
Beta Was this translation helpful? Give feedback.
-
Is it possible to create a Refinement method that has an implicit parameter? Ala Foo[T] {
def bar(i: Int)(using MyImplict): String
} |
Beta Was this translation helpful? Give feedback.
You need to use the
Refined
type wich does have aRefined.apply
factory method.Here is a prototype macro that converts a tuple
("name1" -> T1, "name2" -> T2, ...)
intoRecord { val name1: T1; val name2: T2; ... }
: