copy
Small DSL which parallel Kotlin's built-in copy
, but using optics instead of field names. See Copy for the operations allowed inside the block.
This allows declaring changes on nested elements, preventing the "nested copy
problem". Instead of:
person.copy(address = person.address.copy(city = "Madrid"))
Content copied to clipboard
you can write:
person.copy {
Person.address.city set "Madrid"
}
Content copied to clipboard