Quantum64
12/30/2021, 8:02 PMinline val TestOptics.Companion.nullable: arrow.optics.Optional<TestOptics, Int> inline get()= arrow.optics.Optional(
getOrModify = { testOptics: TestOptics -> testOptics.`nullable`?.right() ?: testOptics.left() },
set = { testOptics: TestOptics, value: Int -> testOptics.copy(`nullable` = value) }
)
Is the arrow Optional optic not equivalent to an affine traversal? If not, what is it equivalent to?Nathan Bedell
12/30/2021, 8:38 PMQuantum64
12/30/2021, 8:39 PMsimon.vergauwen
01/03/2022, 8:21 AMsimon.vergauwen
01/03/2022, 8:22 AMOptional
I think this is indeed correct. That sounds like the behavior of a Lens
for a nullable field.