Automatic generation of record lenses for microlens


Version on this page:
LTS Haskell 22.29:
Stackage Nightly 2024-07-21:
Latest on Hackage:

See all snapshots microlens-th appears in

BSD-3-Clause licensed by Eric Mertens, Edward Kmett, Artyom
Maintained by Artyom
This version can be pinned in stack with:microlens-th-,1767

Module documentation for

This package lets you automatically generate lenses for data types; code was extracted from the lens package, and therefore generated lenses are fully compatible with ones generated by lens (and can be used both from lens and microlens).

This package is a part of the microlens family; see the readme on Github.


  • Bumped the upper bound of template-haskell, as requested by @ocharles.

  • Added abbreviatedFields.

  • Ported a lens commit that (probably) makes lens generation deterministic. See this issue.

  • Added makeClassy (and createClass).

  • Added forgotten copyright/authorship information.

  • The library is now compatible with GHC 8.

  • SimpleGetter and SimpleFold are no longer reexported.

  • Moved Getter and Fold from this package to microlens (they’re in Lens.Micro.Extras).

  • Bumped template-haskell (so that the package would compile with GHC HEAD).

  • Bumped microlens version to be able to use phantom.

  • Bumped microlens version again.

  • Bumped base version.
  • Bumped microlens version.

  • createClass was removed because it doesn’t seem to be useful without lensClass.
  • defaultFieldRules isn’t exported anymore – use camelCaseFields.

  • Package now compiles with -O2 and other optimisations by default.

  • Added makeLensesFor (and lensRulesFor).

  • Wrote a bit of documentation.

Initial release.