Optics from the ground up
summary
Claim: a few practical optics cover most real needs for nested ADTs. Defines concrete lens: focus on product fields with get/modify/set and composes lenses to uppercase a deep classifier name. Introduces prism: focus on sum cases to extract a login from an auth union and shows composing lens+prism yields an optional: mix of lens and prism that safely reads/updates a nested username. Recommends using Monocle for full feature set, notes Shapeless can derive lenses but has tricky implicits, and shows composition rules (lens∘lens=lens, prism∘prism=prism, otherwise optional).
AI-written summary · about
