[Haskell] ANNNOUNCE: lens 3.7 released
ekmett at gmail.com
Fri Dec 7 11:19:28 CET 2012
I am happy to announce the release of version 3.7 of the lens package,
which provides "Lenses, Folds, and Traversals" for working with arbitrary
In its simplest form, a lens is a getter/setter pair, that can be composed
and reasoned about with common sense laws that you can also derive from the
Functor and Traversable laws you already know or even derive by reasoning
in terms of comonad coalgebras for the even more theoretically inclined.
The lens package provides lenses along with a surprisingly powerful set of
generalizations and specializations of this idea, in a manner that subsumes
the notion of a "semantic editor combinator", allowing you to enrich them
with the ability to read back from the targets. In the form taken by the
lenses in this package, lenses are empowered to safely change the types of
the fields that they edit in a manner that not only can you still reason
about, but where the changes in types helps you to reason about what they
can or cannot do.
One of the major design goals of lens has been that you should be able to
pick up lens combinators and apply them meaningfully to a mishmash of
lenses, traversals, isomorphisms, getters, and setters, etc. even without
fully understanding all of the types. This encourages active exploration
and users who are pleasantly surprised rather than frustrated and angry. To
this end we've actively stocked the haddocks for the project with types it
may be easier to think about each combinator as having, which can serve as
training wheels that will help you make your way around.
Most interestingly from a package maintainer perspective, unlike previous
packages that provided lenses, it is possible to provide lenses (and
traversals) that are compatible with the lens library without incurring any
dependency for your package at all. For instance the simplest Traversal is
traverse from Data.Traversable. traverse . traverse is also a valid
Traversal, and it can be composed with other lenses and traversals without
any casting or coercion.
A large number of combinators are provided that automatically 'do the right
thing' when presented with the various generalizations and specializations
of the concept of a lens, e.g. when supplied a Traversal instead of a Lens,
a combinator that returned a result based on the target of the Lens, may
now return a monoidal summary of all of the results targered by the
* Lenses, getters, setters, isomorphisms, folds, "prisms", monadic actions,
and indexed versions of these constructions that can all be composed with
(.) from the Prelude in a manner that they read quite naturally to an
imperative programmer who expects (.) to be field access and to compose in
the 'wrong' direction, while still retaining the ability to reason about
the resulting code.
* Type-safe zippers into arbitrary user data structures, where you can move
down into a lens or laterally through a traversal and can come back up,
following a breadcrumb trail in the type.
* Lens contains a generalized version of Neil Mitchell's uniplate in such a
way that the uniplate combinators themselves that many people already know
how to use can be used on an arbitrary traversal, and uniplate/biplate
simply act as a Traversal, and are often ~35% or more faster than the
* Lens comes "batteries included" with classes and combinators for working
with many common libraries that fall within the Haskell Platform. No
dependencies are incurred that fall outside of the platform, unless those
dependencies are needed to implement lens itself.
* We provide configurable template-haskell generators for producing lenses,
isomorphisms and traversals for your own data types.
New in this release:
* Prisms are categorically dual to Lenses and provide a form of first class
pattern. They can be used directly as a Traversal. Many operations that
formerly required an isomorphism can be used directly on a Prism, and every
Isomorphism can be used as a Prism.
* With this latest release we've incorporated a large amount of community
feedback into the API design and have vastly expanded the documentation
with hundreds of additional examples and test cases.
* We've renamed a number of operations to reduce naming conflicts with
third party libraries to a minimum, and improve consistency. in particular
we no longer conflict with Control.Arrow.
* We've overhauled the zipper API to permit easier use of multiple
simultaneous zippers, and to make zipper movements more compositional.
* Wiki <http://github.com/ekmett/lens/wiki/>: We have a
which includes a number of links to source material, a quick
a discussion of the Derivation<https://github.com/ekmett/lens/wiki/Derivation>,
and even a UML diagram <https://github.com/ekmett/lens#field-guide> distributed
among the other content of the wiki. If you find something missing or
otherwise out of whack then feel free to edit it. =)
* Larger Examples: We also have a number of larger
in the lens distribution, including a fully operational game of Pong that
plays using Gloss and a Brainfuck interpreter.
* IRC: The #haskell-lens<http://webchat.freenode.net/?channels=haskell-lens&uio=d4>channel
irc.freenode.net is full of helpful people who work with or on lens itself.
Lamdabot on #haskell has lens installed, and golfing solutions to user
questions using lens as well as more traditional techniques has become
* I gave a talk last
Google in San Francisco about "Lenses, Folds, and Traversals", and
under 100 people showed up. Sadly, this talk was not recorded.
* However, I plan to give an updated version of that
talk<http://www.meetup.com/NY-Haskell/events/91576512/>at the New
York Haskell User Group <http://www.meetup.com/NY-Haskell/> meeting on
Wednesday, December 12th from 7:00-9:00PM. At the time of this writing we
have 94 slated as coming and room for 26 more, so if you'll be in the New
York area on the 12th and are interested, register soon. =) That said, this
time the talk will be recorded and the video will be made available online,
so even if you can't make it out, you can still enjoy the talk.
* We currently support the last 3 versions of the Haskell Platform,
including versions of GHC back to 7.0.4 and are actively maintaining the
project as part of stackage <https://github.com/fpco/stackage>. We intend
to maintain support for a rolling wave of at least 2 previous Haskell
Platform releases going forward.
* If you have any questions or comments, please feel free to contact me by
email, github, or IRC.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell