If so can you check if any code is generated by ka...
# arrow
s
If so can you check if any code is generated by kapt?
i
This is what I got in my gradle file:
Copy code
kotlin
plugins{
...
id("kotlin")
id("kotlin-kapt")
}
...
dependencies {
...
kapt "io.arrow-kt:arrow-meta:$arrow_version"
implementation "io.arrow-kt:arrow-optics:$arrow_version"
...
}
I am not sure If I have a running kapt plugin. I never worked with it. Did I forget anything?
The issue so far is that I can only use it within one depth.
Copy code
kotlin
// This compiles
val john = Employee( 
 name = "John Doe", 
 company = Company("Kategory",        Address("Functional city", 
Street(44, "lamda Street"))    ))
val employeeCompany: Lens<Employee, Company>  = arrow.optics.Employee.company
// this not
val employeeStreetName: 
Lens<Employee, String> = arrow.optics.Employee.company.street.name
I made it work by composing the data tree — one step at a time.
Copy code
kotlin
val employeeCompany =    {emp:Employee, f: (Company) -> Company ->        Employee.company.modify(emp, f)    }val companyAddress=    {c:Company, f: (Address) -> Address ->      Company.address.modify(c, f)}val addressStreet=    {ad:Address, f: (Street) -> Street ->        Address.street.modify(ad, f)}val employeeAddress =    {e:Employee, f: (Address) -> Address ->        employeeCompany(e) { c:Company -> companyAddress(c, f)}    }val employeeStreet =    {e:Employee, f: (Street) -> Street ->        employeeAddress(e){ a:Address -> addressStreet(a, f) }    }
Is there a more concise version.
I made it work thanks anyways. 🙂
p
@Imran/Malic you have to annotate all of the classes for optics, it doesn’t traverse the tree
hmmmm
r
That should not be necessary
p
your example works too, I don’t think we have the extension function version so that works 🙂
r
The companion should have the projected lenses composed as demonstrated in the docs
It's possible that Meta is not called that way unless you are in the latest snapshot
Check the docs for https://0-8-2.arrow-kt.io
kapt "io.arrow-ktarrow annotations processor$arrow_version"
And if you are in the snapshot is called just arrow-meta
i
I am in the snapshot @raulraja. And I annotated every data class with optics which was in the tree hierarchy. Still, I could not access the values. After a few hours, Idea resolved it magically, and I could do the computations as in the docs. I'm looking for an HTTP framework for checking changes of a server status? I found fuel are there any other alternatives. I am open to suggestions. The server status changes its status every 30 sec.