Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ArrowKT - @optics annotation not generating code

How do you setup the Arrow dependencies for @optics annotation to actually work? No companion objects are generated for the data classes annotated with @optics.

If I'm not mistaken, this is an annotation processor, so it should be imported using kapt, however the documentation uses it as compile.

like image 800
m0skit0 Avatar asked Oct 16 '25 02:10

m0skit0


1 Answers

For arrow 0.10.0

apply plugin: 'kotlin-kapt'

def arrow_version = "0.10.1-SNAPSHOT"
dependencies {
    implementation "io.arrow-kt:arrow-optics:$arrow_version"
    implementation "io.arrow-kt:arrow-syntax:$arrow_version"
    kapt    "io.arrow-kt:arrow-meta:$arrow_version" // <-- this is the kapt plugin
}

then:

@optics data class Street(val number: Int, val name: String) {
    companion object {} // <-- this is required
}
like image 167
LordRaydenMK Avatar answered Oct 18 '25 19:10

LordRaydenMK