lens package:diagrams-lib

Build a Lens from a getter and a setter.
lens :: Functor f => (s -> a) -> (s -> b -> t) -> (a -> f b) -> s -> f t
>>> s ^. lens getter setter
getter s
>>> s & lens getter setter .~ b
setter s b
>>> s & lens getter setter %~ f
setter s (f (getter s))
lens :: (s -> a) -> (s -> a -> s) -> Lens' s a
A Lens is actually a lens family as described in http://comonad.com/reader/2012/mirrored-lenses/. With great power comes great responsibility and a Lens is subject to the three common sense Lens laws: 1) You get back what you put in:
view l (set l v s)  ≡ v
2) Putting back what you got doesn't change anything:
set l (view l s) s  ≡ s
3) Setting twice is the same as setting once:
set l v' (set l v s) ≡ set l v' s
These laws are strong enough that the 4 type parameters of a Lens cannot vary fully independently. For more on how they interact, read the "Why is it a Lens Family?" section of http://comonad.com/reader/2012/mirrored-lenses/. There are some emergent properties of these laws: 1) set l s must be injective for every s This is a consequence of law #1 2) set l must be surjective, because of law #2, which indicates that it is possible to obtain any v from some s such that set s v = s 3) Given just the first two laws you can prove a weaker form of law #3 where the values v that you are setting match:
set l v (set l v s) ≡ set l v s
Every Lens can be used directly as a Setter or Traversal. You can also use a Lens for Getting as if it were a Fold or Getter. Since every Lens is a valid Traversal, the Traversal laws are required of any Lens you create:
l purepure
fmap (l f) . l g ≡ getCompose . l (Compose . fmap f . g)
type Lens s t a b = forall f. Functor f => LensLike f s t a b
Lens' to access the option for naming "classy" lenses.
Lens' to access the convention for naming fields in our LensRules.
Rules for making fairly simple partial lenses, ignoring the special cases for isomorphisms and traversals, and not making any classes. It uses underscoreNoPrefixNamer.
Construct a LensRules value for generating top-level definitions using the given map from field names to definition names.
type Lens' = Simple Lens
Many combinators that accept a Lens can also accept a Traversal in limited situations. They do so by specializing the type of Functor that they require of the caller. If a function accepts a LensLike f s t a b for some Functor f, then they may be passed a Lens. Further, if f is an Applicative, they may also be passed a Traversal.
type LensLike' f = Simple (LensLike f)
Rules to construct lenses for data fields.
When you see this as an argument to a function, it expects a Lens. This type can also be used when you need to store a Lens in a container, since it is rank-1. You can turn them back into a Lens with cloneLens, or use it directly with combinators like storing and (^#).
When you see this as an argument to a function, it expects an IndexedLens
An IndexPreservingLens leaves any index it is composed with alone.
Every IndexedLens is a valid Lens and a valid IndexedTraversal.
Convenient alias for constructing indexed lenses and their ilk.
Convenient alias for constructing simple indexed lenses and their ilk.
Reify an IndexedLens so it can be stored safely in a container.