O object

Lambda

extends Object with Serializable

Lambda expression extractor

Supertypes

Object, Serializable

Members

def 

unapply

[F, Args, Res, G] ( expr: Expr[F] ) ( implicit  qctx: QuoteContext tf: TupledFunction[F,Args => Res] tg: TupledFunction[G,Map[Args,Expr[T]] => Expr[Res]] functionType: Type[F] ) : Option[G]

case Lambda(fn) matches a lambda by lifting the function from S => T to Expr[S] => Expr[T]. As the body may (will) contain references to the paramter,

case Lambda(fn) matches a lambda by lifting the function from S => T to Expr[S] => Expr[T]. As the body may (will) contain references to the paramter, body is a function that recieves those arguments as Expr. Once this function is applied the result will be the body of the lambda with all references to the parameters replaced. If body is of type (T1, T2, ...) => R then body will be of type (Expr[T1], Expr[T2], ...) => Expr[R].

'{ (x: Int) => println(x) } match
  case Lambda(body) =>
    // where `body` is: (x: Expr[Int]) => '{ println($x) }
    body('{3}) // returns '{ println(3) }