# gcanti/monocle-ts

Functional optics: a (partial) porting of Scala monocle

Repository: https://github.com/gcanti/monocle-ts
Canonical: https://ross.abutalabs.com/products/monocle-ts
Homepage: https://gcanti.github.io/monocle-ts/
Language: TypeScript
License: MIT
License Family: permissive
Topics: typescript, functional-programming, lenses, optics
Last push: 2022-12-09T10:12:08+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 3490, "days_push": 1363, "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 1075, forks 55 (observed 2026-08-28T04:03:29.164834+00:00)

## What it is
monocle-ts is a TypeScript library providing functional optics (Lenses, Prisms, Isos, Traversals, and more), ported from the Scala Monocle library. It enables concise, composable, and type-safe updates to deeply nested immutable data structures.

## Use cases
- update nested immutable objects without verbose spread copies
- compose lenses to zoom into deeply nested fields
- modify immutable state in a type-safe functional style
- focus on optional or array elements with prisms and traversals
- reduce boilerplate when transforming deeply nested TypeScript data

## When to choose
- you work with deeply nested immutable data in TypeScript
- you already use fp-ts and want a functional optics library
- you want composable, type-safe accessors instead of manual spread chains

## When to avoid
- your data structures are shallow and simple spreads suffice
- you prefer mutable state or don't use functional programming patterns
- you need a library with frequent updates - the latest release is from late 2022

## Facets
- artifact type: library
- maturity: maintenance
- function: serialization, developer-tools
- domain: developer-tools, web-development
- platform: cross-platform
- tags: optics, lenses, immutable-data, functional-programming, scala-monocle-port, fp-ts, nodejs, typescript

## Member repositories
- gcanti/monocle-ts (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:29.164834+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-30T06:53:26.267870+00:00, confidence not recorded.
  - readme: https://github.com/gcanti/monocle-ts (fetched 2026-08-28T04:03:29.164834+00:00, sha 9abf3f52c744)
  - homepage: https://gcanti.github.io/monocle-ts/ (fetched 2026-08-29T12:54:56.417919+00:00, sha 539aa2daa040)
  - registry_npm: https://registry.npmjs.org/monocle-ts (fetched 2026-08-29T12:54:56.427045+00:00, sha 0f3951c6e999)
- Data as of 2026-08-30T08:39:29.467469+00:00.
