scala.quoted.Quotes.reflectModule.LambdaModule
Methods of the module object val Lambda
Generates a lambda with the given method type.
Generates a lambda with the given method type.
Block((DefDef(_, _, params :: Nil, _, Some(rhsFn(meth, paramRefs)))) :: Nil, Closure(meth, _))
Usage:
val mtpe = MethodType(List("arg1"))(_ => List(TypeRepr.of[Int]), _ => TypeRepr.of[Int])
Lambda(owner, mtpe, {
case (methSym, List(arg1: Term)) =>
ValDef.let(methSym, f(arg1)) { ... }
}
)
Usage with quotes:
val mtpe = MethodType(List("arg1"))(_ => List(TypeRepr.of[Int]), _ => TypeRepr.of[Int])
Lambda(owner, mtpe, {
case (methSym, List(arg1: Term)) =>
given Quotes = methSym.asQuotes
'{ ... }
}
)
Value parameters
owner of the generated meth
symbol
Function that receives the meth
symbol and the a list of references to the params
Type of the definition
Matches a lambda definition of the form
Matches a lambda definition of the form
Block((DefDef(_, _, params :: Nil, _, Some(body))) :: Nil, Closure(meth, _))
Extracts the parameter definitions and body.
AttributesRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4