<div dir="ltr"><div>You can&#39;t write that lens by hand, so it isn&#39;t surprising that the template haskell can&#39;t generate it either. =)<br></div><div><br></div><div>ImpredicativeTypes don&#39;t work all that well.</div>
<div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 8, 2013 at 9:49 AM, Artyom Kazak <span dir="ltr">&lt;<a href="mailto:yom@artyom.me" target="_blank">yom@artyom.me</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here’s a small example, which, when compiled, gives an error. Why?<br>
<br>
    {-# LANGUAGE FlexibleInstances, ImpredicativeTypes,<br>
                 TemplateHaskell #-}<br>
<br>
    import Control.Lens<br>
<br>
    class Item a where<br>
      name :: a -&gt; String<br>
<br>
    instance Item (String, Int) where<br>
      name = fst<br>
<br>
    type ItemFilter = Item a =&gt; a -&gt; Bool<br>
<br>
    data ItemBox = ItemBox { _itemFilter :: ItemFilter }<br>
    makeLenses &#39;&#39;ItemBox<br>
<br>
The error is<br>
<br>
    Couldn&#39;t match type `a0 -&gt; Bool&#39;<br>
                  with `forall a. Item a =&gt; a -&gt; Bool&#39;<br>
    Expected type: ItemFilter<br>
      Actual type: a0 -&gt; Bool<br>
    In the expression: b_aaZE<br>
    In the first argument of `iso&#39;, namely<br>
      `\ (ItemBox b_aaZE) -&gt; b_aaZE&#39;<br>
    In the expression: iso (\ (ItemBox b_aaZE) -&gt; b_aaZE) ItemBox<br>
<br>
I’m using GHC 7.6.2, if it’s important.<br>
<br>
______________________________<u></u>_________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>