A lightweight lens library for Haskell, compatible with lens
open sourceBSD-3-Clausefree
microlens is a small Haskell lens library compatible with Edward Kmett's lens: it keeps the essential lenses and traversals (_1, _Just), handy ones (each, at, ix) and a few combinators, and strips everything else, so the core package has no dependencies and builds in seconds. A family of packages adds the rest: microlens-th generates lenses with Template Haskell (makeLenses), microlens-mtl adds State and Reader operators, microlens-ghc instances for GHC's containers, and microlens-platform (recommended for apps) bundles them with instances for common packages; microlens-contra and microlens-pro add more.
Problems it solves
- use lenses in a Haskell library without depending on the whole lens package
- generate lenses for my record types with makeLenses but fast builds
- a lightweight alternative to lens for Haskell apps
Features
- essential lenses and traversals with no dependencies
- compatible with lens
- Template Haskell lens generation (microlens-th)
- State and Reader operators (microlens-mtl)
- batteries-included microlens-platform for applications
Alternatives
The same job
These do what microlens does.
- lens Lenses, folds and traversals for Haskell
- optics Lenses, traversals and prisms for Haskell through an abstract interface
- profunctors Profunctor type classes and constructions for Haskell
- indexed-traversable FunctorWithIndex, FoldableWithIndex and TraversableWithIndex for Haskell
- adjunctions Adjunctions and representable functors for Haskell
- transformers Concrete functor and monad transformers for Haskell