compiler-plugin / arrow.meta.quotes.expression / LambdaExpression

LambdaExpression

class LambdaExpression : Scope<KtLambdaExpression>

lambdaExpression(“””$(params)”””, “”“$bodyExpression”””)

A template destructuring Scope for a KtLambdaExpression.

import arrow.meta.Meta
import arrow.meta.CliPlugin
import arrow.meta.invoke
import arrow.meta.quotes.Transform
import arrow.meta.quotes.lambdaExpression

val Meta.reformatFor: CliPlugin
  get() =
    "ReformatLambda" {
      meta(
       lambdaExpression({ true }) { e ->
         Transform.replace(
           replacing = e,
           newDeclaration = lambdaExpression("""$`(params)`""", """$bodyExpression""")
         )
       }
      )
    }

Constructors

<init> lambdaExpression(“””$(params)”””, “”“$bodyExpression”””)LambdaExpression(value: KtLambdaExpression, functionLiteral: FunctionLiteral = FunctionLiteral(value.functionLiteral), (params): ScopedList<KtParameter> = ScopedList(value = value.valueParameters), bodyExpression: BlockExpression? = BlockExpression(value.bodyExpression))

Properties

(params) val (params): ScopedList<KtParameter>
bodyExpression val bodyExpression: BlockExpression?
functionLiteral val functionLiteral: FunctionLiteral
value val value: KtLambdaExpression

Functions

identity fun ElementScope.identity(): LambdaExpression

Extension Functions

map fun <K : KtElement> Scope<K>.map(f: (K) -> K): Scope<K>
orEmpty fun <K : KtElement> Scope<K>?.orEmpty(): Scope<K>

Do you like Arrow?

Arrow Org
<