lens-simple: simplified import of elementary lens-family combinators
This module, Lens.Simple,
just re-exports the main modules from Russell O'Connor's
lens-family package, the
original van Laarhoven-O'Connor lens library.
lens-family
is particularly remarkable for its minute number of dependencies:
(apart from mtl
they are all ghc 'boot' libraries); but more importantly for its
extreme conceptual simplicity and theoretical soundness. Much of
the material it contains is well-explained, from a tutorial point of view, by
lens-tutorial It is independent,
self-standing and readily intelligible apart from any darker
more general system of combinators that might attempt to extend it. Much
of it ought to be in the Prelude.
Convenient import of the elementary combinators from lens-family
,
however, a little complicated. The idea of this trivial module, then, is just to make a sort of
low-powered, minimal-dependency, lens-family
equivalent of
the 800 lb gorilla of lens library imports:
import Control.Lens
namely, the light-weight and elegant:
import Lens.Simple
Check it out, it's even one character shorter!
The material in lens-tutorial will work fine if you make this substitution in the underlying source and follow along as prompted.
As another illustration of the simplicity of the
fundamental van Laarhoven-O'Connor lens combinators - and their homogeneity with
Control.Lens
- note that the gloss
pong example
from the lens
library examples directory - which continues to be
among the best introductory lens tutorials precisely by saying nothing -
requires only this abbreviating change of imports.
If you make that program more complicated,
you might of course end up needing
the more sophisticated material in Control.Lens
and
its immense mass of dependencies. On the other hand,
you might just need some of the additional material
present in the similarly demystifying
microlens
or microlens-th and
the associated modules.
This module was originally intended to simplify the use of packages that
follow the original promise of the van Laarhoven-O'Connor lenses.
Correct practice is to export lenses without depending on a lens-library, where possible.
In basic cases these just use familiar Prelude
types, after all.
Examples of best practices in this respect are e.g. lens-family-th which
doesn't depend on lens-family
despite its name and pipes-related packages like
pipes-bytestring
and pipes-group.
Lens.Simple
also re-exports convenient TH incantations like
makeLenses
from Dan Burton's associated
lens-family-th.
[Skip to Readme]
Downloads
- lens-simple-0.1.0.9.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.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6, 0.1.0.7, 0.1.0.8, 0.1.0.9 |
---|---|
Change log | changelog |
Dependencies | base (>=4 && <5), lens-family (>=1.2 && <1.3), lens-family-core (>=1.2 && <1.3), lens-family-th (<0.6), mtl (>=2.1 && <2.3), transformers (>=0.2.0 && <6) [details] |
License | BSD-3-Clause |
Copyright | 2012, 2013, 2014 Russell O'Connor; 2015 Michael Thompson |
Author | michaelt |
Maintainer | what_is_it_to_do_anything@yahoo.com |
Category | Lenses |
Home page | https://github.com/michaelt/lens-simple |
Source repo | head: git clone https://github.com/michaelt/lens-simple |
Uploaded | by MichaelThompson at 2016-06-23T15:45:49Z |
Distributions | |
Reverse Dependencies | 8 direct, 45 indirect [details] |
Downloads | 8763 total (37 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |