Tag: Functional Programming

  • Sealed Classes in Kotlin: How to handle the missing .copy() method (2026 Update)

    Sealed Classes in Kotlin: How to handle the missing .copy() method (2026 Update)

    A few weeks ago we looked at one of my pain points of working with Kotlin Data Classes: nested copy and we improved on a basic Kotlin solution using a Lens. Today we look at another type of nesting: Sealed Classes nesting. When we wanted to create some sort of restricted hierarchy in Java we…

  • How to fix the pain of modifying Kotlin nested data classes

    How to fix the pain of modifying Kotlin nested data classes

    When Kotlin arrived a few years ago one of the selling points was immutability: In object-oriented and functional programming, an immutable object (unchangeable object) is an object whose state cannot be modified after it is created. https://en.wikipedia.org/wiki/Immutable_object This is very cool! Value objects are such a huge help when it comes to reasoning about code, safety and avoiding weird subtle misbehaviours due to “things…