Lens
Noun · Development
Definitions
A composable pair of getter/setter functions for focusing on a specific part of an immutable data structure. Lenses can be composed to access deeply nested fields without mutation. Eliminates the pain of updating nested immutable data. Available in Haskell (lens), Scala (Monocle), and TypeScript (monocle-ts).
In plain English: A tool for reading and updating deeply nested data in immutable structures without verbose copying.
Example: "Compose the address lens with the zipCode lens to update user.address.zipCode without mutating — the lens creates a new copy with just that field changed."