Nir
09/09/2020, 7:21 PMplugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.0'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
jcenter()
maven { url "<https://dl.bintray.com/arrow-kt/arrow-kt/>" }
maven { url "<https://oss.jfrog.org/artifactory/oss-snapshot-local/>" } // for SNAPSHOT builds
}
apply plugin: 'kotlin-kapt'
def arrow_version = "0.11.0"
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
implementation "io.arrow-kt:arrow-optics:$arrow_version"
implementation "io.arrow-kt:arrow-syntax:$arrow_version"
kapt "io.arrow-kt:arrow-meta:$arrow_version"
}
Rachel
09/09/2020, 7:23 PM1.0.0-SNAPSHOT
(one number is missing in your code snippet). Please, let us know if that's the issue, thanks!Rachel
09/09/2020, 7:25 PMNir
09/09/2020, 7:27 PMNir
09/09/2020, 7:33 PMNir
09/09/2020, 7:34 PMNir
09/09/2020, 7:39 PMRachel
09/09/2020, 7:57 PMpackage
in one of your code files. I'll improve that error to point to the file.Nir
09/09/2020, 7:58 PMimport arrow.optics.*
//@optics data class Foo(val bar: Bar) { companion object }
//@optics data class Bar(val bar: Baz) { companion object }
@optics data class Baz(val bar: Int) { companion object }
fun main() {
println("hello world!")
}
Rachel
09/09/2020, 7:59 PMpackage
as the first line before the importsRachel
09/09/2020, 8:00 PMpackage com.nir
the IDE will suggest you to relocate the file under src/main/kotlin/com/nir/
Nir
09/09/2020, 8:02 PMNir
09/09/2020, 8:02 PMNir
09/09/2020, 8:02 PMpackage foo
import arrow.optics.*
@optics data class Foo(val bar: Bar) { companion object }
@optics data class Bar(val bar: Baz) { companion object }
@optics data class Baz(val int: Int) { companion object }
Nir
09/09/2020, 8:02 PMimport foo.*
fun main() {
val x = Foo(Bar(Baz(5)))
val lens = Foo.bar
println(x)
}
Nir
09/09/2020, 8:03 PMNir
09/09/2020, 8:03 PM"C:\Program Files\Java\jdk-12.0.1\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.1\lib\idea_rt.jar=59862:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\quick\IdeaProjects\untitled\build\classes\kotlin\main;C:\Users\quick\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.3.72\8032138f12c0180bc4e51fe139d4c52b46db6109\kotlin-stdlib-1.3.72.jar;C:\Users\quick\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.72\6ca8bee3d88957eaaaef077c41c908c9940492d8\kotlin-stdlib-common-1.3.72.jar;C:\Users\quick\.gradle\caches\modules-2\files-2.1\org.jetbrains\annotations\13.0\919f0dfe192fb4e063e7dacadee7f8bb9a2672a9\annotations-13.0.jar MainKt
Exception in thread "main" java.lang.NoClassDefFoundError: arrow/optics/PLens
at MainKt.main(main.kt:8)
at MainKt.main(main.kt)
Caused by: java.lang.ClassNotFoundException: arrow.optics.PLens
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 2 more
Process finished with exit code 1
Nir
09/09/2020, 8:03 PMRachel
09/09/2020, 8:12 PMRachel
09/09/2020, 8:15 PMbuild.gradle
because it's added automatically by the Kotlin pluginNir
09/09/2020, 8:15 PMNir
09/09/2020, 8:15 PMNir
09/09/2020, 8:16 PMfun main() {
val x = Foo(Bar(Baz(5)))
println(KotlinVersion.CURRENT)
println(Foo.bar.baz.int.modify(x) {20} )
}
Nir
09/09/2020, 8:16 PMRachel
09/09/2020, 8:16 PMNir
09/09/2020, 8:16 PM