Look It Up
Find the question you hold, then go to the page that answers it.
The pages a returning reader comes back to, holding a question rather than reading in order.
| You hold | Go to |
|---|---|
| A question a senior engineer asks before adopting optics: cost, allocation, caching, build time, team conventions | Production Readiness |
| An annotation, and you want what it generates | Annotations at a Glance |
| A type you do not own, such as a Jackson node or a JOOQ record | Optics for External Types |
A build question: Lombok beside the processor, incremental compilation, -Werror | Production Readiness: build-time impact |
| A data shape, a task or a constraint, and you want the optic or API for it | Decision Trees |
| A common nested-update problem, and you want a recipe for it | Cookbook |
An optic, and you want to know whether it declares get, set, getAll, matches... | Optic Capabilities |
| One optic type, and you need another | Conversions |
Two optics, and you want the type andThen returns | Composition Rules |
A wither, a stream or a switch, and you want the optic that replaces it | Coming from Lombok, Streams and Switch |
A name from Monocle or Haskell's lens, or a behaviour you expect from them | Coming from Monocle or Haskell lens |
| A Focus DSL question: a pattern, a pitfall, the FAQ | Focus DSL Reference |
| A compiler message from a generated optic | Common Compiler Errors |
Most lookups resolve to one distinction: an optic either declares an operation or it does not, and when it does not, a conversion usually reaches it anyway. Here a lens and its fold read the customer's name for Ada's order:
Lens<Order, String> customerName = OrderLenses.customer().andThen(CustomerLenses.name());
String name = customerName.get(order);
// "Ada": get is declared on Lens
// customerName.getAll(order);
// will not compile: getAll is on Fold, not Lens
Fold<Order, String> asFold = customerName.asFold();
List<String> all = asFold.getAll(order);
// ["Ada"]: the same access, one conversion later
Optic Capabilities is the table of what each optic declares, and Conversions the table of how to get from one to another.
Previous: Interpreters Next: Production Readiness