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 holdGo to
A question a senior engineer asks before adopting optics: cost, allocation, caching, build time, team conventionsProduction Readiness
An annotation, and you want what it generatesAnnotations at a Glance
A type you do not own, such as a Jackson node or a JOOQ recordOptics for External Types
A build question: Lombok beside the processor, incremental compilation, -WerrorProduction Readiness: build-time impact
A data shape, a task or a constraint, and you want the optic or API for itDecision Trees
A common nested-update problem, and you want a recipe for itCookbook
An optic, and you want to know whether it declares get, set, getAll, matches...Optic Capabilities
One optic type, and you need anotherConversions
Two optics, and you want the type andThen returnsComposition Rules
A wither, a stream or a switch, and you want the optic that replaces itComing from Lombok, Streams and Switch
A name from Monocle or Haskell's lens, or a behaviour you expect from themComing from Monocle or Haskell lens
A Focus DSL question: a pattern, a pitfall, the FAQFocus DSL Reference
A compiler message from a generated opticCommon 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