https://kotlinlang.org logo
#arrow-contributors
Title
# arrow-contributors
r

rawtoast

05/31/2018, 8:07 AM
I’ve not spent much time with the optics in Arrow, but is it possible to compose lenses? Pseudocode, so usual warnings apply:
@optics data class Thing(str: String, num:Int)
val mark = Thing.str.modify( it + "!")
val inc = Thing.num.modify( it + 1)
val combinedLens = mark.pipe(inc)
p

pakoito

05/31/2018, 10:05 AM
Yes, all of them have a
compose
method and have a composition table and everything. That’s their main use case 😄 See https://arrow-kt.io/docs/optics/optional/#composition for example
🎉 1
etc
6 Views