# optics-dev/Monocle

Optics library for Scala

Repository: https://github.com/optics-dev/Monocle
Canonical: https://ross.abutalabs.com/products/monocle
Homepage: https://www.optics.dev/Monocle/
Language: Scala
License: MIT
License Family: permissive
Topics: scala, functional-programming, optics, lens, typelevel, cats
Last push: 2026-08-21T22:18:15+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 8, longevity 100
- inputs: {"age_days": 4611, "days_push": 12, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1700, forks 207 (observed 2026-08-28T04:05:24.225196+00:00)

## What it is
Monocle is a Scala optics library providing a simple yet powerful API to access and transform immutable data using lenses, prisms, traversals, and other optics. It integrates with Cats and supports Scala 2.13 and 3.x.

## Use cases
- update a nested field in an immutable case class
- modify values inside Option or List fields immutably
- get, replace, or modify deeply nested data structures
- compose optics like Lens, Prism, and Traversal
- insert, delete, or upsert entries in a Map via at/index optics
- work with immutable data in a functional programming style

## When to choose
- you are writing Scala with immutable data models and need ergonomic nested updates
- you use Cats/Typelevel ecosystem and want a mature optics library
- you need composable access and transformation of deeply nested or optional structures

## When to avoid
- your project uses mutable data structures where direct field assignment suffices
- you are not using Scala or the JVM
- you want a minimal dependency footprint and don't need optics abstractions

## Facets
- artifact type: library
- maturity: active
- function: serialization, developer-tools
- domain: -
- platform: jvm
- tags: optics, lens, functional-programming, immutable-data, typelevel, cats, scala

## Member repositories
- optics-dev/Monocle (main) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:24.225196+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:37:46.271998+00:00, confidence not recorded.
  - readme: https://github.com/optics-dev/Monocle (fetched 2026-08-28T04:05:24.225196+00:00, sha c0721f8f8b14)
  - homepage: https://www.optics.dev/Monocle/ (fetched 2026-08-29T11:12:22.709821+00:00, sha b4aae4ccb211)
  - site_page: https://www.optics.dev/Monocle/docs/optics (fetched 2026-08-29T11:12:22.721839+00:00, sha c1cd21a76d3c)
  - site_page: https://www.optics.dev/Monocle/docs/release_notes (fetched 2026-08-29T11:12:22.723705+00:00, sha 04b87f68441e)
  - site_page: https://www.optics.dev/Monocle/docs/faq (fetched 2026-08-29T11:12:22.728669+00:00, sha 10d983c0e643)
  - site_page: https://www.optics.dev/Monocle/docs/focus (fetched 2026-08-29T11:12:22.730561+00:00, sha 522e44d36e57)
  - site_page: https://www.optics.dev/Monocle/api/monocle/index.html (fetched 2026-08-29T11:12:22.719645+00:00, sha 44b2cc92991b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
