Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.quoted/Quotes/reflectModule/LambdaModule

LambdaModule

scala.quoted.Quotes.reflectModule.LambdaModule

Methods of the module objectval Lambda

Attributes

Source
Quotes.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type
Quotes.this.reflectModule.this.Lambda.type

Members list

Value members

Abstract methods

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

owner of the generatedmeth symbol

rhsFn

Function that receives themeth symbol and the a list of references to theparams

tpe

Type of the definition

Attributes

Source
Quotes.scala

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.

Attributes

Source
Quotes.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp