lens: Lenses, Folds and Traversals
The combinators in Control.Lens provide a highly generic toolbox for composing
families of getters, folds, isomorphisms, traversals, setters and lenses and their indexed variants.
Lens Families
For a longer description of why you should care about lens families, and an overview of why we use 4 parameters a, b, c, and d instead of just 2, see http://comonad.com/reader/2012/mirrored-lenses/.
Sometimes you won't need the flexibility those extra parameters afford you and you can use
type Simple f a b = f a a b b
to describe a Simple Setter, Simple Traversal, Simple Lens or Simple Iso.
Avoiding Dependencies
Note: If you merely want your library to provide lenses you may not
have to actually import any lens library at all. For, say, a
, just export a function with the signature:Simple Lens Bar Foo
foo :: Functor f => (Foo -> f Foo) -> Bar -> f Bar
and then you can compose it with other lenses using nothing more than (.) from the Prelude.
Deriving Lenses
You can derive lenses automatically for many data types using makeLenses, and if a
container is fully characterized by its lenses, you can use Representable to
automatically derive Functor, Applicative, Monad, and Distributive.
[Skip to Readme]
Modules
[Index]
- Control
- Exception
- Control.Lens
- Control.Lens.Action
- Control.Lens.Fold
- Control.Lens.Getter
- Control.Lens.Indexed
- Control.Lens.IndexedFold
- Control.Lens.IndexedGetter
- Control.Lens.IndexedLens
- Control.Lens.IndexedSetter
- Control.Lens.IndexedTraversal
- Control.Lens.Internal
- Control.Lens.Iso
- Control.Lens.Representable
- Control.Lens.Setter
- Control.Lens.TH
- Control.Lens.Traversal
- Control.Lens.Type
- Parallel
- Strategies
- Seq
- Data
- Array
- Bits
- ByteString
- Complex
- Dynamic
- Either
- IntMap
- IntSet
- List
- Map
- Pair
- Sequence
- Set
- Text
- Tree
- GHC
- Generics
- Language
- Haskell
Flags
Manual Flags
| Name | Description | Default |
|---|---|---|
| examples | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- lens-1.7.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.0.1, 1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0.5), base (>=4.3 && <5), bytestring (>=0.9.1.10 && <0.10), containers (>=0.4.2 && <0.6), ghc-prim, gloss (>=1.7 && <1.8), lens (==1.7), mtl (>=2.0.1 && <2.2), parallel (>=3.1.0.1 && <3.3), random (>=1.0 && <1.1), template-haskell (>=2.4 && <2.8), text (>=0.11.1.5 && <0.12), transformers (>=0.3 && <0.4) [details] |
| Tested with | ghc ==7.4.1 |
| License | BSD-3-Clause |
| Copyright | Copyright (C) 2012 Edward A. Kmett |
| Author | Edward A. Kmett |
| Maintainer | Edward A. Kmett <ekmett@gmail.com> |
| Uploaded | by EdwardKmett at 2012-08-08T09:00:02Z |
| Category | Data, Lenses |
| Home page | http://github.com/ekmett/lens/ |
| Bug tracker | http://github.com/ekmett/lens/issues |
| Source repo | head: git clone git://github.com/ekmett/lens.git |
| Distributions | Arch:5.3.3, Debian:4.18.1, Fedora:5.3.4, FreeBSD:4.12.3, LTSHaskell:5.3.6, NixOS:5.3.5, Stackage:5.3.6, openSUSE:5.3.5 |
| Reverse Dependencies | 1498 direct, 7053 indirect [details] |
| Executables | pong |
| Downloads | 430758 total (522 in the last 30 days) |
| Rating | 3.0 (votes: 51) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs uploaded by user Build status unknown [no reports yet] |
