Hello, I am an absolute beginner in the field of ...
# arrow
d
Hello, I am an absolute beginner in the field of optics and have chosen a task that is too complex for me right at the beginning... I want to read values from a nested structure with several lists and a field that can also be null. This is how the readout should work, whereas I'm stuck on the second Every and how I would have to deal with the nullable field. This is what I would like to achieve:
Copy code
A.b                          // Lens<A, List<B>>
                            .every(Every.list())         // Every<A, B>
                            .c                           // Every<A, List<C>>

                            // How to do something like this
                            .every(Every.list())         // Every<A, C>
                            .nullableX                   // Every<A, D?>
                            .e                           // Every<A, E?>
                            .getAllOrNull(instance of A) // Goal list(e1, e2, null, e3, null, null)
s
https://arrow-kt.io/learn/immutable-data/optional/#nullable-types There should be a
notNull
extension where you have
nullableX
. Or did I missunderstand your goal?
d
Hello @simon.vergauwen, thanks for the feedback. Unfortunately, I only saw it now since Slack didn't show me a notification.... The main problem was the focus over several lists. So List<A>.List<B>.List<C>.field. I have now been able to solve this by linking several lenses. Is this the way or is there a better alternative? Every.list<A>().b + Every.list<B>().c + Every.list().field