Skip to content

Commit

Permalink
Documentation: update Arrow Meta example (#2373)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelcarmena committed Apr 9, 2021
1 parent f5a7ca6 commit 11b0154
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 4 additions & 4 deletions arrow-site/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ apply from: "../arrow-libs/gradle/main.gradle"
apply from: "../arrow-libs/gradle/subproject.gradle"

dependencies {
compile "io.arrow-kt:arrow-optics:$VERSION_NAME"
compile "io.arrow-kt:arrow-core:$VERSION_NAME"
compile "io.arrow-kt:arrow-fx-coroutines:$VERSION_NAME"
compile "io.arrow-kt:arrow-fx-stm:$VERSION_NAME"
implementation "io.arrow-kt:arrow-optics:$VERSION_NAME"
implementation "io.arrow-kt:arrow-core:$VERSION_NAME"
implementation "io.arrow-kt:arrow-fx-coroutines:$VERSION_NAME"
implementation "io.arrow-kt:arrow-fx-stm:$VERSION_NAME"
compileOnly "org.jetbrains.kotlin:kotlin-reflect:$KOTLIN_VERSION"

kapt "io.arrow-kt:arrow-meta:$VERSION_NAME"
Expand Down
10 changes: 8 additions & 2 deletions arrow-site/docs/_code/meta-home-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
library: meta
---
```kotlin
import arrow.meta.CliPlugin
import arrow.meta.Meta
import arrow.meta.invoke
import arrow.meta.quotes.Transform
import arrow.meta.quotes.namedFunction

//sampleStart

val Meta.helloWorld: CliPlugin get() =
"Hello World" {
meta(
namedFunction(this, { name == "helloWorld" }) { c -> // <-- namedFunction(...) {...}
namedFunction(this, { element.name == "helloWorld" }) { (c, _) -> // <-- namedFunction(...) {...}
Transform.replace(
replacing = c,
newDeclaration = """|fun helloWorld(): Unit =
| println("Hello ΛRROW Meta!")
|""".function
|""".function(descriptor).syntheticScope
)
}
)
Expand Down

0 comments on commit 11b0154

Please sign in to comment.