<div>Greetings!</div><span id="goog_892676398"></span><span id="goog_892676399"></span><a href="/"></a><div><br></div>I am happy to announce the release of version 3.7 of the <font face="courier new, monospace">lens</font> package, which provides &quot;Lenses, Folds, and Traversals&quot; for working with arbitrary data types.<div>
<br></div><div>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.</div>
<div><br></div><div>The <font face="courier new, monospace">lens</font> 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 &quot;semantic editor combinator&quot;, 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.</div>
<div><br></div><div>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&#39;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.</div>
<div><br></div><div><div>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 <span style="font-family:&#39;courier new&#39;,monospace">lens</span> library without incurring any dependency for your package at all. For instance the simplest Traversal is <font face="courier new, monospace">traverse</font> from Data.Traversable. <font face="courier new, monospace">traverse . traverse</font> is also a valid Traversal, and it can be composed with other lenses and traversals without any casting or coercion.</div>
</div><div><br></div><div>A large number of combinators are provided that automatically &#39;do the right thing&#39; 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 Traversal.</div>
<div><br></div><div>Major Features:</div><div><br></div><div>* Lenses, getters, setters, isomorphisms, folds, &quot;prisms&quot;, 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 &#39;wrong&#39; direction, while still retaining the ability to reason about the resulting code.</div>
<div><br></div><div>* 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.</div><div><br>
</div><div>* Lens contains a generalized version of Neil Mitchell&#39;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 original.</div>
<div><br></div><div>* Lens comes &quot;batteries included&quot; 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.</div>
<div><br></div><div>* We provide configurable template-haskell generators for producing lenses, isomorphisms and traversals for your own data types.</div><div><br></div><div>New in this release:</div><div><br></div><div>* 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.</div>
<div><br></div><div>* With this latest release we&#39;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.</div>
<div><br></div><div>* We&#39;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. </div><div>
<br></div><div>* We&#39;ve overhauled the zipper API to permit easier use of multiple simultaneous zippers, and to make zipper movements more compositional.</div><div><br></div><div>Resources:</div><div><br></div><div><div>
* <a href="http://github.com/ekmett/lens/wiki/">Wiki</a>: We have a <a href="https://github.com/ekmett/lens/wiki/FAQ">FAQ</a>, which includes a number of links to source material, a quick <a href="https://github.com/ekmett/lens#examples">getting-started</a> guide, a discussion of the <a href="https://github.com/ekmett/lens/wiki/Derivation">Derivation</a>, and even a <a href="https://github.com/ekmett/lens#field-guide">UML diagram</a> distributed among the other content of the wiki. If you find something missing or otherwise out of whack then feel free to edit it. =)</div>
<div><br></div><div>* Larger Examples: We also have a number of <a href="https://github.com/ekmett/lens/tree/master/examples">larger examples</a> included in the lens distribution, including a fully operational game of Pong that plays using Gloss and a Brainfuck interpreter.</div>
</div><div><br></div><div>* IRC: The <font face="courier new, monospace"><a href="http://webchat.freenode.net/?channels=haskell-lens&amp;uio=d4">#haskell-lens</a></font> channel on <font face="courier new, monospace"><a href="http://irc.freenode.net">irc.freenode.net</a></font> is full of helpful people who work with or on lens itself. Lamdabot on <font face="courier new, monospace">#haskell</font> has <span style="font-family:&#39;courier new&#39;,monospace">lens</span> installed, and golfing solutions to user questions using lens as well as more traditional techniques has become disturbingly common.</div>
<div>as</div><div><br></div><div>* I <a href="http://google-opensource.blogspot.com/2012/10/lenses-folds-and-traversals-haskell.html">gave a talk last month</a> at Google in San Francisco about &quot;Lenses, Folds, and Traversals&quot;, and just under 100 people showed up. Sadly, this talk was not recorded.</div>
<div><br></div><div>* However, <a href="http://www.meetup.com/NY-Haskell/events/91576512/">I plan to give an updated version of that talk</a> at the <a href="http://www.meetup.com/NY-Haskell/">New York Haskell User Group</a> 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&#39;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&#39;t make it out, you can still enjoy the talk.</div>
<div><br></div><div>Support: </div><div><br></div><div>* 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 <a href="https://github.com/fpco/stackage">stackage</a>. We intend to maintain support for a rolling wave of at least 2 previous Haskell Platform releases going forward.</div>
<div><br></div><div>* If you have any questions or comments, please feel free to contact me by email, github, or IRC.</div><div><br></div><div>-Edward</div>