BSD-3-Clause licensed by Edward Kmett, Artyom Kazak
Maintained by Steven Fontanella
This version can be pinned in stack with:microlens-0.4.13.1@sha256:fc256e2b5d78e8e4f39b3dd359c57b8c19df50853a86eaf8f154a17441a5a51d,4703

Module documentation for 0.4.13.1

NOTE: If you're writing an app, you probably want microlens-platform – it has the most features. microlens is intended more for library writers who want a tiny lens library (after all, lenses are pretty useful for everything, not just for updating records!).

This library is an extract from lens (with no dependencies). It's not a toy lenses library, unsuitable for “real world”, but merely a small one. It is compatible with lens, and should have same performance. It also has better documentation.

There's a longer readme on Github. It has a migration guide for lens users, a description of other packages in the family, a discussion of other lens libraries you could use instead, and so on.

Here are some usecases for this library:

  • You want to define lenses or traversals in your own library, but don't want to depend on lens. Having lenses available often make working with a library more pleasant.

  • You just want to be able to use lenses to transform data (or even just use over _1 to change the first element of a tuple).

  • You are new to lenses and want a small library to play with.

However, don't use this library if:

  • You need Isos, Prisms, indexed traversals, or actually anything else which isn't defined here (though some indexed functions are available elsewhere – containers and vector provide them for their types, and ilist provides indexed functions for lists).

  • You want a library with a clean, understandable implementation (in which case you're looking for lens-simple).

As already mentioned, if you're writing an application which uses lenses more extensively, look at microlens-platform – it combines features of most other microlens packages (microlens-mtl, microlens-th, microlens-ghc).

If you want to export getters or folds and don't mind the contravariant dependency, please consider using microlens-contra.

If you haven't ever used lenses before, read this tutorial. (It's for lens, but it applies to microlens just as well.)

Note that microlens has no dependencies starting from GHC 7.10 (base-4.8). Prior to that, it depends on transformers-0.2 or above.

Changes

0.4.13.0

  • Added _Show, worded, and lined.

0.4.12.0

  • Added instance Ixed (NonEmpty a) for GHC >= 8.

0.4.11.3

  • Exported a coerce compatibility shim from Lens.Micro.Internal.

0.4.11.2

  • Fixed compilation on GHC 8.8 (thanks to @vmchale).

0.4.11.1

  • Reverted marking Lens.Micro.Internal as Trustworthy, see #122.

0.4.11

  • Added fixity declarations for +~ and -~ (thanks to Francesco Ariis).
  • Added rewriteOf and transformOf (thanks to @quasicomputational).
  • Added an instance Each (Either a a) (Either b b) a b, following lens’s suit.
  • Marked Lens.Micro.Internal as Trustworthy starting from GHC 7.8.

0.4.10

  • Added +~ and -~.
  • Marked #. and .# with INLINE.

0.4.9.1

  • Reexported <&> from Data.Functor (on recent versions of base).

0.4.9

  • Added <>~.
  • Added fixities for <%~, <<%~, <<.~.

0.4.8.3

  • Fixed compilation on GHC 8.4.

0.4.8.2

Skipped (the tarball got corrupted).

0.4.8.1

  • Added HasCallStack for some partial functions.

0.4.8.0

  • Added forOf_ and forOf.
  • Added an instance for Each (NonEmpty a) (available starting from GHC 8).

0.4.7.0

  • Fixed the Haddock crash on GHC 8 by removing default method implementations (each = traverse and ix = ixAt). If you had custom instances of Ixed or Each which relied on default methods, they’d stop working.

0.4.6.0

  • Added traverseOf and traverseOf_.
  • Changed fixities of #. and .# to the ones in the profunctors package. Those operators are only available from Lens.Micro.Internal, so this shouldn’t affect most users.

0.4.5.0

  • Added <&> (which makes lens creation easier).

0.4.4.3

  • Fixed markup in the .cabal file.
  • Added descriptions of other packages to Lens.Micro.

0.4.4.2

  • More changes to make microlens-platform more prominent.

0.4.4.1

  • Pointed to microlens-platform in the synopsis.

0.4.4.0

  • Added mapAccumLOf.

0.4.3.0

  • Added ?~.

0.4.2.1

  • Added forgotten copyright/authorship information.

0.4.2.0

  • Added singular.

0.4.1.0

  • Added strict and lazy.

0.4.0.1

  • Fixed a bug that wasn’t letting the package compile with GHC 8.0 (see issue #63).

0.4.0.0

  • Added folding.
  • Renamed Getter and Fold to SimpleGetter and SimpleFold and put them into Lens.Micro. Genuine Getter and Fold are available in microlens-contra.
  • Replaced Applicative (Const r) constraints with Monoid r because it’s the same thing but easier to understand.

0.3.5.1

  • Backported the fix for the bug that wasn’t letting the package compile with GHC 8.0 (see issue #63).

0.3.5.0

  • Added Lens.Micro.Extras with view, preview, Getter, and Fold. Now you no longer need microlens-mtl if the only thing you need from it is view.

0.3.4.1

  • Changed the description of the package from “A tiny part of the lens library which you can depend upon” to “A tiny part of the lens library with no dependencies” because the previous one was ambiguous (I admit I kinda liked that ambiguity, though).

0.3.4.0

  • Added non.

0.3.3.0

  • Added filtered.
  • Added Safe Haskell pragmas.

0.3.2.0

  • Added toListOf back.
  • Added to.

0.3.1.0

  • Added LensLike and LensLike'.
  • Added failing.

0.3.0.0

  • Moved Lens.Micro.Classes into Lens.Micro.Internal.
  • Added <%~, <<%~, <<.~.
  • Added _head, _tail, _init, _last.

0.2.0.0

  • Removed toListOf.
  • Removed +~, -~, *~, //~ and the Lens.Micro.Extras module.

0.1.5.0

  • Added ix and at.
  • Added traversed.
  • Moved some things into Lens.Micro.Internal.
  • Bumped base version.

0.1.3.0

  • Moved some things into Lens.Micro.Type and Lens.Micro.Classes.
  • Each and Field* aren’t exported by Lens.Micro now.

0.1.2.0

  • Added each.

0.1.1.0

  • Added ASetter', which is useful because we can’t provide real Setter and Setter'.

0.1.0.0

First release.