hmf
1
How can I define newValF
shown below? I keep getting errors in the using
parameter.
TIA
def newVal[S: Type](cls: Symbol, name: String, t : Expr[S]) =
// Later we map to columns T
println(s"$name : ${TypeRepr.of[S].show} = ?")
Symbol.newVal(cls, name, TypeRepr.of[S], Flags.EmptyFlags /*Flags.Inline*/, Symbol.noSymbol )
val newValF =
[A, S] => (cls: Symbol, name: String, t : Expr[S]) => (using Type[S]) => newVal[S](cls, name, t)
Maybe using context functions? Context Functions
2 Likes
hmf
3
@WojciechMazur Thanks. It worked (for version 3.4.2). For future reference here is a code snippet:
def newVal[S: Type](cls: Symbol, name: String, t : Expr[S]) =
println(s"$name : ${TypeRepr.of[S].show} = ?")
Symbol.newVal(cls, name, TypeRepr.of[S], Flags.EmptyFlags, Symbol.noSymbol )
def newValF[S] : [S] => (Symbol, String, Expr[S]) => Type[S] ?=> Symbol =
[S] => (a: Symbol, b: String, c: Expr[S]) => newVal[S](a,b,c)
def valList2[A](cls: Symbol, x: Expr[IMap], map: [S] => (Symbol, String, Expr[S]) => Type[S] ?=> A ): List[A] =
...
val value = map(cls, name, valueValue)
...
To make it easier to read, one can also use a type alias.
1 Like