<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Lenses, Folds and Traversals</title>
    <link>http://lens.github.com/</link>
    <atom:link href="http://lens.github.com/rss.xml" rel="self" type="application/rss+xml" />
    <description>Lenses, Folds and Traversals</description>
    <language>en-us</language>
    <pubDate>Mon, 09 Apr 2018 02:47:28 +0000</pubDate>
    <lastBuildDate>Mon, 09 Apr 2018 02:47:28 +0000</lastBuildDate>

    
    <item>
      <title>Video: Simon Peyton Jones at the Haskell Exchange on Lenses</title>
      <link>http://skillsmatter.com/podcast/scala/lenses-compositional-data-access-and-manipulation</link>
      <pubDate>Wed, 09 Oct 2013 00:00:00 +0000</pubDate>
      <author>Simon Peyton Jones</author>
      <guid>http://skillsmatter.com/podcast/scala/lenses-compositional-data-access-and-manipulation</guid>
      <description>
</description>
    </item>
    
    <item>
      <title>Haskell's strength: generalising with lenses</title>
      <link>http://statusfailed.com/blog/2013/01/26/haskells-strength-generalising-with-lenses.html</link>
      <pubDate>Sat, 26 Jan 2013 00:00:00 +0000</pubDate>
      <author>Paul Wilson</author>
      <guid>http://statusfailed.com/blog/2013/01/26/haskells-strength-generalising-with-lenses.html</guid>
      <description>
</description>
    </item>
    
    <item>
      <title>Video from New York Haskell: Lenses, Folds and Traversals</title>
      <link>https://www.youtube.com/watch?v=cefnmjtAolY&hd=1&t=1m14s</link>
      <pubDate>Sat, 26 Jan 2013 00:00:00 +0000</pubDate>
      <author>Edward Kmett</author>
      <guid>https://www.youtube.com/watch?v=cefnmjtAolY&hd=1&t=1m14s</guid>
      <description>&lt;h3 id=&quot;video&quot;&gt;Video&lt;/h3&gt;

&lt;p&gt;There is a two hour video from the New York Haskell meetup where Edward Kmett gave a crash course on lenses that dives into the derivation and use of lenses.&lt;/p&gt;

&lt;iframe width=&quot;1200&quot; height=&quot;720&quot; src=&quot;http://www.youtube.com/embed/cefnmjtAolY&amp;amp;hd=1&amp;amp;t=1m14s&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;1&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;&lt;a href=&quot;http://comonad.com/haskell/Lenses-Folds-and-Traversals-NYC.pdf&quot;&gt;Slides from this talk&lt;/a&gt; are also available.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Varying lens properties by instance</title>
      <link>https://github.com/ekmett/lens/wiki/Varying-lens-properties-by-instance</link>
      <pubDate>Sun, 16 Dec 2012 00:00:00 +0000</pubDate>
      <author>Adrian Keet</author>
      <guid>https://github.com/ekmett/lens/wiki/Varying-lens-properties-by-instance</guid>
      <description>&lt;p&gt;Say we have a few types for things that have a “name”, which is a &lt;code class=&quot;highlighter-rouge&quot;&gt;String&lt;/code&gt; that may or may not be modifiable. We want to have a type class for these things that exposes a lens-like method for accessing the name in a type-safe manner, so that it may be a Lens or just a Getter depending on the instance.&lt;/p&gt;

&lt;p&gt;First let’s write some example types and some lenses for them:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-haskell&quot; data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;cp&quot;&gt;{-# LANGUAGE MultiParamTypeClasses #-}&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;{-# LANGUAGE TypeFamilies, ConstraintKinds #-}&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Control.Lens&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;GHC.Exts&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- for the Constraint kind&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;newtype&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;newtype&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;

       &lt;span class=&quot;c1&quot;&gt;-- Functor f =&amp;gt; SimpleLensLike f ReadWrite String&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;rwName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SimpleLens&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;rwName&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fmap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;`&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;

       &lt;span class=&quot;c1&quot;&gt;-- Gettable f =&amp;gt; SimpleLensLike f ReadWrite String&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;roName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Getter&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;roName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now &lt;code class=&quot;highlighter-rouge&quot;&gt;rwName&lt;/code&gt; is a full Lens, while &lt;code class=&quot;highlighter-rouge&quot;&gt;roName&lt;/code&gt; can only be used as a Getter. We’d like to make a single class that lets us get and set the name of a &lt;code class=&quot;highlighter-rouge&quot;&gt;ReadWrite&lt;/code&gt;, but only get the name of a &lt;code class=&quot;highlighter-rouge&quot;&gt;ReadOnly&lt;/code&gt;.&lt;/p&gt;

&lt;h1 id=&quot;using-a-multi-parameter-type-class&quot;&gt;Using a multi-parameter type class&lt;/h1&gt;
&lt;p&gt;Now the only difference between a Getter and a Lens is the restriction on the type of Functor it can be used with. So, the first idea is to let our class take that Functor as a parameter:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-haskell&quot; data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NamedMPTC&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;where&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;nameMPTC&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SimpleLensLike&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Functor&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NamedMPTC&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;where&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;nameMPTC&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rwName&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Gettable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NamedMPTC&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;where&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;nameMPTC&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roName&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;And now &lt;code class=&quot;highlighter-rouge&quot;&gt;nameMPTC&lt;/code&gt; gives us a type-safe way to get what we want from both &lt;code class=&quot;highlighter-rouge&quot;&gt;ReadOnly&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;ReadWrite&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-haskell&quot; data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;n&quot;&gt;ghci&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;^.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nameMPTC&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ghci&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nameMPTC&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.~&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;b&quot;&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;b&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ghci&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;c&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;^.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nameMPTC&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;&quot;c&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ghci&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;c&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nameMPTC&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.~&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;d&quot;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;-- No instance for (Gettable Mutator) arising from a use of `nameMPTC' ...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This appears to work pretty well. We can easily restrict to different types of Functors; for example, restricting to Applicative will make &lt;code class=&quot;highlighter-rouge&quot;&gt;nameMPTC&lt;/code&gt; a Traversal, in case we had something with multiple names.&lt;/p&gt;

&lt;p&gt;When we try to use this in practice, however, we run into problems. If &lt;code class=&quot;highlighter-rouge&quot;&gt;NamedMPTC&lt;/code&gt; had another method that made no reference to &lt;code class=&quot;highlighter-rouge&quot;&gt;f&lt;/code&gt;, then any time we tried to use it, the type checker would blow up with an ambiguous type error! The only way around this would be to have our lens-like method be in its own class, which sounds pretty undesirable. What we needed was a way to impose the constraint on &lt;code class=&quot;highlighter-rouge&quot;&gt;f&lt;/code&gt; &lt;em&gt;only&lt;/em&gt; on the lens-like method, not the entire class. So let’s forget this and look at another approach.&lt;/p&gt;

&lt;h1 id=&quot;using-the-constraint-kind&quot;&gt;Using the Constraint kind&lt;/h1&gt;
&lt;p&gt;This means we’ll need at least GHC 7.4. Let’s see the code first:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-haskell&quot; data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Named&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;where&lt;/span&gt;
    &lt;span class=&quot;kr&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NameConstraint&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Constraint&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NameConstraint&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SimpleLensLike&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Named&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;where&lt;/span&gt;
    &lt;span class=&quot;kr&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NameConstraint&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadWrite&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Functor&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rwName&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Named&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;where&lt;/span&gt;
    &lt;span class=&quot;kr&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;NameConstraint&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Gettable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;roName&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let’s see how the types work. First let’s look at the type of &lt;code class=&quot;highlighter-rouge&quot;&gt;name&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-haskell&quot; data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;NameConstraint&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Named&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SimpleLensLike&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;When we specialize to &lt;code class=&quot;highlighter-rouge&quot;&gt;a = ReadOnly&lt;/code&gt;, the &lt;code class=&quot;highlighter-rouge&quot;&gt;Named a&lt;/code&gt; constraint is satisfied and &lt;code class=&quot;highlighter-rouge&quot;&gt;NameConstraint a f&lt;/code&gt; just becomes &lt;code class=&quot;highlighter-rouge&quot;&gt;Gettable f&lt;/code&gt;, so we end up with&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-haskell&quot; data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;::&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Gettable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SimpleLensLike&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ReadOnly&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;which is exactly the type of &lt;code class=&quot;highlighter-rouge&quot;&gt;roName&lt;/code&gt; we had before.&lt;/p&gt;

&lt;p&gt;With this approach, &lt;code class=&quot;highlighter-rouge&quot;&gt;name&lt;/code&gt; works exactly how &lt;code class=&quot;highlighter-rouge&quot;&gt;nameMPTC&lt;/code&gt; did earlier. But notice that this time the constraint on &lt;code class=&quot;highlighter-rouge&quot;&gt;f&lt;/code&gt; is only applied to &lt;code class=&quot;highlighter-rouge&quot;&gt;name&lt;/code&gt;, not the entire class. This means we can easily add other methods to the class without causing any ambiguous type issues, and we can even add different lens-like methods with different constraints. Fantastic!&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Lens development to date, visualized</title>
      <link>http://youtu.be/ADAprOOgi-A?hd=1</link>
      <pubDate>Fri, 14 Dec 2012 00:00:00 +0000</pubDate>
      <author>Johan Kiviniemi</author>
      <guid>http://youtu.be/ADAprOOgi-A?hd=1</guid>
      <description>
</description>
    </item>
    
    <item>
      <title>On the static nature of traversals</title>
      <link>http://r6.ca/blog/20121209T182914Z.html</link>
      <pubDate>Sun, 09 Dec 2012 00:00:00 +0000</pubDate>
      <author>Russell O'Connor</author>
      <guid>http://r6.ca/blog/20121209T182914Z.html</guid>
      <description>
</description>
    </item>
    
    <item>
      <title>24 Days of Hackage: lens</title>
      <link>http://ocharles.org.uk/blog/posts/2012-12-09-24-days-of-hackage-lens.html</link>
      <pubDate>Sun, 09 Dec 2012 00:00:00 +0000</pubDate>
      <author>Oliver Charles</author>
      <guid>http://ocharles.org.uk/blog/posts/2012-12-09-24-days-of-hackage-lens.html</guid>
      <description>
</description>
    </item>
    
    <item>
      <title>[ANNOUNCE] lens 3.7</title>
      <link>http://haskell.1045720.n5.nabble.com/ANNNOUNCE-lens-3-7-released-td5721968.html</link>
      <pubDate>Fri, 07 Dec 2012 00:00:00 +0000</pubDate>
      <author>Edward Kmett</author>
      <guid>http://haskell.1045720.n5.nabble.com/ANNNOUNCE-lens-3-7-released-td5721968.html</guid>
      <description>		&lt;div&gt;Greetings!&lt;/div&gt;&lt;span id=&quot;goog_892676398&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_892676399&quot;&gt;&lt;/span&gt;&lt;a href=&quot;/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;&lt;/a&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;I am happy to announce the release of version 3.7 of the &lt;font face=&quot;courier new, monospace&quot;&gt;lens&lt;/font&gt; package, which provides &amp;quot;Lenses, Folds, and Traversals&amp;quot; for working with arbitrary data types.&lt;div&gt;
&lt;br&gt;&lt;/div&gt;&lt;div&gt;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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;The &lt;font face=&quot;courier new, monospace&quot;&gt;lens&lt;/font&gt; 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 &amp;quot;semantic editor combinator&amp;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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;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&amp;#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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;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 &lt;span style=&quot;font-family:&amp;#39;courier new&amp;#39;,monospace&quot;&gt;lens&lt;/span&gt; library without incurring any dependency for your package at all. For instance the simplest Traversal is &lt;font face=&quot;courier new, monospace&quot;&gt;traverse&lt;/font&gt; from Data.Traversable. &lt;font face=&quot;courier new, monospace&quot;&gt;traverse . traverse&lt;/font&gt; is also a valid Traversal, and it can be composed with other lenses and traversals without any casting or coercion.&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;A large number of combinators are provided that automatically &amp;#39;do the right thing&amp;#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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Major Features:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* Lenses, getters, setters, isomorphisms, folds, &amp;quot;prisms&amp;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 &amp;#39;wrong&amp;#39; direction, while still retaining the ability to reason about the resulting code.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* 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.&lt;/div&gt;&lt;div&gt;&lt;br&gt;
&lt;/div&gt;&lt;div&gt;* Lens contains a generalized version of Neil Mitchell&amp;#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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* Lens comes &amp;quot;batteries included&amp;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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* We provide configurable template-haskell generators for producing lenses, isomorphisms and traversals for your own data types.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;New in this release:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* 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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* With this latest release we&amp;#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.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* We&amp;#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. &lt;/div&gt;&lt;div&gt;
&lt;br&gt;&lt;/div&gt;&lt;div&gt;* We&amp;#39;ve overhauled the zipper API to permit easier use of multiple simultaneous zippers, and to make zipper movements more compositional.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Resources:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;
* &lt;a href=&quot;http://github.com/ekmett/lens/wiki/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;Wiki&lt;/a&gt;: We have a &lt;a href=&quot;https://github.com/ekmett/lens/wiki/FAQ&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;FAQ&lt;/a&gt;, which includes a number of links to source material, a quick &lt;a href=&quot;https://github.com/ekmett/lens#examples&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;getting-started&lt;/a&gt; guide, a discussion of the &lt;a href=&quot;https://github.com/ekmett/lens/wiki/Derivation&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;Derivation&lt;/a&gt;, and even a &lt;a href=&quot;https://github.com/ekmett/lens#field-guide&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;UML diagram&lt;/a&gt; distributed among the other content of the wiki. If you find something missing or otherwise out of whack then feel free to edit it. =)&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* Larger Examples: We also have a number of &lt;a href=&quot;https://github.com/ekmett/lens/tree/master/examples&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;larger examples&lt;/a&gt; included in the lens distribution, including a fully operational game of Pong that plays using Gloss and a Brainfuck interpreter.&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* IRC: The &lt;font face=&quot;courier new, monospace&quot;&gt;&lt;a href=&quot;http://webchat.freenode.net/?channels=haskell-lens&amp;amp;uio=d4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;#haskell-lens&lt;/a&gt;&lt;/font&gt; channel on &lt;font face=&quot;courier new, monospace&quot;&gt;&lt;a href=&quot;http://irc.freenode.net&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;irc.freenode.net&lt;/a&gt;&lt;/font&gt; is full of helpful people who work with or on lens itself. Lamdabot on &lt;font face=&quot;courier new, monospace&quot;&gt;#haskell&lt;/font&gt; has &lt;span style=&quot;font-family:&amp;#39;courier new&amp;#39;,monospace&quot;&gt;lens&lt;/span&gt; installed, and golfing solutions to user questions using lens as well as more traditional techniques has become disturbingly common.&lt;/div&gt;
&lt;div&gt;as&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* I &lt;a href=&quot;http://google-opensource.blogspot.com/2012/10/lenses-folds-and-traversals-haskell.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;gave a talk last month&lt;/a&gt; at Google in San Francisco about &amp;quot;Lenses, Folds, and Traversals&amp;quot;, and just under 100 people showed up. Sadly, this talk was not recorded.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* However, &lt;a href=&quot;http://www.meetup.com/NY-Haskell/events/91576512/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;I plan to give an updated version of that talk&lt;/a&gt; at the &lt;a href=&quot;http://www.meetup.com/NY-Haskell/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;New York Haskell User Group&lt;/a&gt; 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&amp;#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&amp;#39;t make it out, you can still enjoy the talk.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Support: &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* 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 &lt;a href=&quot;https://github.com/fpco/stackage&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;stackage&lt;/a&gt;. We intend to maintain support for a rolling wave of at least 2 previous Haskell Platform releases going forward.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;* If you have any questions or comments, please feel free to contact me by email, github, or IRC.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;-Edward&lt;/div&gt;

</description>
    </item>
    
    <item>
      <title>Getting Started with Lenses</title>
      <link>http://newartisans.com/2012/11/getting-started-with-lenses/</link>
      <pubDate>Wed, 21 Nov 2012 00:00:00 +0000</pubDate>
      <author>John Wiegley</author>
      <guid>http://newartisans.com/2012/11/getting-started-with-lenses/</guid>
      <description>
</description>
    </item>
    
    <item>
      <title>ANN: NY Haskell presents Edward Kmett on Lenses, Folds, and Traversals -- Wed., December 12</title>
      <link>http://haskell.1045720.n5.nabble.com/ANN-NY-Haskell-presents-Edward-Kmett-on-Lenses-Folds-and-Traversals-Wed-December-12-td5720745.html</link>
      <pubDate>Tue, 20 Nov 2012 00:00:00 +0000</pubDate>
      <author>Gershom Bazerman</author>
      <guid>http://haskell.1045720.n5.nabble.com/ANN-NY-Haskell-presents-Edward-Kmett-on-Lenses-Folds-and-Traversals-Wed-December-12-td5720745.html</guid>
      <description>The first NY Haskell Users Group meetup was a great success -- with
&lt;br/&gt;roughly sixty attendees and conversations that stretched far too late
&lt;br/&gt;for a weekday night. Video and slides are available for both the
&lt;br/&gt;Practical Data Processing and Cloud Haskell talks:
&lt;br/&gt;&lt;br/&gt;Video: &lt;a href=&quot;http://vimeo.com/53906049&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://vimeo.com/53906049&lt;/a&gt;&lt;br/&gt;Slides on Practical Data Processing:
&lt;br/&gt;&lt;a href=&quot;http://gbaz.github.com/slides/PracticalData-11-2012.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://gbaz.github.com/slides/PracticalData-11-2012.pdf&lt;/a&gt;&lt;br/&gt;Slides on Cloud Haskell: &lt;a href=&quot;http://gbaz.github.com/slides/cloud-11-2012.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://gbaz.github.com/slides/cloud-11-2012.html&lt;/a&gt;&lt;br/&gt;Source for Cloud Haskell:
&lt;br/&gt;&lt;a href=&quot;https://github.com/gbaz/slides/blob/gh-pages/cloud-11-2012.lhs&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;https://github.com/gbaz/slides/blob/gh-pages/cloud-11-2012.lhs&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;We expect our next meetup will be equally exciting, at a bare minimum.
&lt;br/&gt;We're actively seeking cool talks and presentations. If you're not a
&lt;br/&gt;New York local, but may be passing through or are in the tri-state
&lt;br/&gt;area or thereabouts, and would like to present some code or research
&lt;br/&gt;with even tangentially real-world implications to an informed and
&lt;br/&gt;appreciated audience, please do get in touch :-)
&lt;br/&gt;&lt;br/&gt;Also, there will be a NY tech holiday party on December 11th, which we
&lt;br/&gt;are organizing along with other NY technology and PL groups. Details
&lt;br/&gt;are available at the on the meetup site:
&lt;br/&gt;&lt;a href=&quot;http://www.meetup.com/NY-Haskell/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://www.meetup.com/NY-Haskell/&lt;/a&gt;. Finally, at some point, we will
&lt;br/&gt;probably cease to spam -cafe with announcements of all our events, so
&lt;br/&gt;even if you can't make it to the next few ones, registering at the
&lt;br/&gt;meetup site is the best way to stay on top of what we will have
&lt;br/&gt;planned.
&lt;br/&gt;&lt;br/&gt;- - - -
&lt;br/&gt;&lt;br/&gt;Lenses, Folds, and Traversals
&lt;br/&gt;presented by Edward Kmett
&lt;br/&gt;&lt;br/&gt;Wednesday, December 12, 2012
&lt;br/&gt;7:00 PM To 9:00 PM
&lt;br/&gt;&lt;br/&gt;Pivotal Labs, 841 Broadway New York, NY
&lt;br/&gt;(8th Floor)
&lt;br/&gt;&lt;br/&gt;RSVP: &lt;a href=&quot;http://www.meetup.com/NY-Haskell/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://www.meetup.com/NY-Haskell/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Edward Kmett will introduce his lens library, which provides a highly
&lt;br/&gt;composable toolbox for accessing and modifying multiple parts of data
&lt;br/&gt;structures.
&lt;br/&gt;&lt;br/&gt;From simple beginnings, starting with building blocks such as fmap and
&lt;br/&gt;(.), we will build up combinators suitable for working with a wide
&lt;br/&gt;array of data structures. These generalize the notions you already
&lt;br/&gt;know how to use into a form that is easier to compose, and
&lt;br/&gt;simultaneously allow them to be used for monomorphic containers such
&lt;br/&gt;as Data.Text. All without compromising on your ability to reason about
&lt;br/&gt;them using laws!
&lt;br/&gt;&lt;br/&gt;Once we've built up some foundations, we'll do a bit of a deep dive,
&lt;br/&gt;exploring consequences of this design. We will discuss the efficient
&lt;br/&gt;generic programming programming framework exported by lens, and
&lt;br/&gt;type-safe Traversal-based zippers.
&lt;br/&gt;&lt;br/&gt;Familiarity with the Applicative and Traversable classes from the
&lt;br/&gt;Haskell base libraries will be helpful (links provided below), but a
&lt;br/&gt;basic understanding of the concepts will be introduced we go along.
&lt;br/&gt;Attendees should expect to be gobsmacked with a newfound appreciation
&lt;br/&gt;for the power of a little (or a lot of) abstraction.
&lt;br/&gt;&lt;br/&gt;Useful (but not mandatory) references:
&lt;br/&gt;&lt;br/&gt;The lens library and documentation: &lt;a href=&quot;http://hackage.haskell.org/package/lens&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://hackage.haskell.org/package/lens&lt;/a&gt;&lt;br/&gt;A previous, more introductory talk on how to use the lenses Edward
&lt;br/&gt;Kmett wrote for the scalaz in the Scala programming language:
&lt;br/&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=efv0SQNde5Q&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;https://www.youtube.com/watch?v=efv0SQNde5Q&lt;/a&gt;&lt;br/&gt;The original Applicative paper:
&lt;br/&gt;&lt;a href=&quot;http://www.soi.city.ac.uk/~ross/papers/Applicative.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://www.soi.city.ac.uk/~ross/papers/Applicative.pdf&lt;/a&gt;&lt;br/&gt;Lots of information on Traversable:
&lt;br/&gt;&lt;a href=&quot;http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf&lt;/a&gt;&lt;br/&gt;A write-up of this talk, as presented at the Bay Area Haskell Users
&lt;br/&gt;Group: &lt;a href=&quot;http://google-opensource.blogspot.com/2012/10/lenses-folds-and-traversals-haskell.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot; link=&quot;external&quot;&gt;http://google-opensource.blogspot.com/2012/10/lenses-folds-and-traversals-haskell.html&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
</description>
    </item>
    
    <item>
      <title>Mirrored Lenses</title>
      <link>http://comonad.com/reader/2012/mirrored-lenses/</link>
      <pubDate>Sun, 24 Jun 2012 00:00:00 +0000</pubDate>
      <author>Edward Kmett</author>
      <guid>http://comonad.com/reader/2012/mirrored-lenses/</guid>
      <description>
</description>
    </item>
    
    <item>
      <title>Polymorphic update with van Laarhoven lenses</title>
      <link>http://r6.ca/blog/20120623T104901Z.html</link>
      <pubDate>Sat, 23 Jun 2012 00:00:00 +0000</pubDate>
      <author>Russell O'Connor</author>
      <guid>http://r6.ca/blog/20120623T104901Z.html</guid>
      <description>
</description>
    </item>
    

  </channel>
</rss>
