# lens

> Lenses, folds and traversals for Haskell

Source: https://talira.ai/catalog/lens-w72sargm
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / functional programming](https://talira.ai/categories/libraries/functional-programming), [languages / haskell](https://talira.ai/categories/languages/haskell)
- Licence: BSD-2-Clause[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Edward Kmett](https://talira.ai/orgs/edward-kmett.md)

lens is a Haskell library of lenses, isomorphisms, folds, traversals, getters and setters: composable optics for reading and updating parts of nested data structures. It comes with ready-made lenses for the types in common use and tools that generate lenses and isomorphisms for your own data types, and its Control.Lens combinators compose into a generic toolbox for working with structured data.

## Links

- Website: https://lens.github.io/
- GitHub: https://github.com/ekmett/lens
- Docs: https://lens.github.io/

## Problems it solves

- update a field deep inside nested Haskell records without unpacking every level
- generate getters and setters for my Haskell data types automatically
- traverse and modify every matching element of a Haskell data structure

## Features

- lenses, prisms, isomorphisms, folds, traversals, getters and setters
- generated lenses for user data types
- batteries-included lenses for common types
- Control.Lens combinators

## Trust

Overall: 0.49 out of 1.
Signals: maintenance 0.53, adoption 0.66, momentum 0.34, community 0.89, backing 0.30, extensibility 0.00.

- last commit 46 days ago
- 12 commits in the last 90 days
- 2.1k GitHub stars
- 167 contributors
- backed by Edward Kmett

## Alternatives

- [microlens](https://talira.ai/catalog/microlens-7d9zprsq.md): A lightweight lens library for Haskell, compatible with lens
- [optics](https://talira.ai/catalog/optics-jfhnkr9z.md): Lenses, traversals and prisms for Haskell through an abstract interface
- [indexed-traversable](https://talira.ai/catalog/indexed-traversable-85zf8der.md): FunctorWithIndex, FoldableWithIndex and TraversableWithIndex for Haskell

## Sources

[^1]: https://github.com/ekmett/lens/blob/master/LICENSE (checked 27 Nov 2026)
