<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>Comments on: Fixing lists</title>
	<atom:link href="http://conal.net/blog/posts/fixing-lists/feed" rel="self" type="application/rss+xml" />
	<link>http://conal.net/blog/posts/fixing-lists</link>
	<description>Inspirations &#38; experiments, mainly about denotative/functional programming in Haskell</description>
	<lastBuildDate>Sat, 26 Sep 2020 21:06:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.17</generator>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; From tries to trees</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-800</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; From tries to trees]]></dc:creator>
		<pubDate>Wed, 02 Feb 2011 23:11:11 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-800</guid>
		<description><![CDATA[&lt;p&gt;[...] Fixing lists [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] Fixing lists [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Reverse-engineering length-typed vectors</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-799</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; Reverse-engineering length-typed vectors]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 17:58:09 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-799</guid>
		<description><![CDATA[&lt;p&gt;[...] Fixing lists [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] Fixing lists [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; A trie for length-typed vectors</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-798</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; A trie for length-typed vectors]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 06:21:07 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-798</guid>
		<description><![CDATA[&lt;p&gt;[...] Fixing lists [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] Fixing lists [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-797</link>
		<dc:creator><![CDATA[conal]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 01:20:53 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-797</guid>
		<description><![CDATA[&lt;p&gt;Maxime: I just posted my solution in &lt;a href=&quot;http://conal.net/blog/posts/doing-more-with-length-typed-vectors/&quot; rel=&quot;nofollow&quot;&gt;&lt;em&gt;Doing more with length-typed vectors&lt;/em&gt;&lt;/a&gt;. It&#039;s something of a cheat, since I add another type class to get the job done.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Maxime: I just posted my solution in <a href="http://conal.net/blog/posts/doing-more-with-length-typed-vectors/" rel="nofollow"><em>Doing more with length-typed vectors</em></a>. It&#8217;s something of a cheat, since I add another type class to get the job done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Doing more with length-typed vectors</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-796</link>
		<dc:creator><![CDATA[Conal Elliott &#187; Blog Archive &#187; Doing more with length-typed vectors]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 01:16:16 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-796</guid>
		<description><![CDATA[&lt;p&gt;[...] About      &#171; Fixing lists [...]&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>[&#8230;] About      &laquo; Fixing lists [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maxime Henrion</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-795</link>
		<dc:creator><![CDATA[Maxime Henrion]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 00:34:01 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-795</guid>
		<description><![CDATA[&lt;p&gt;conal: Ah, it&#039;s good to know those warnings were actually a bug in GHC, and that it&#039;s already reported. Indeed, the Applicative (Vec n) constraints are cumbersome, and I&#039;m even more curious to see how you&#039;ve managed this :-)&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>conal: Ah, it&#8217;s good to know those warnings were actually a bug in GHC, and that it&#8217;s already reported. Indeed, the Applicative (Vec n) constraints are cumbersome, and I&#8217;m even more curious to see how you&#8217;ve managed this <img src="http://conal.net/blog/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-794</link>
		<dc:creator><![CDATA[conal]]></dc:creator>
		<pubDate>Mon, 31 Jan 2011 00:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-794</guid>
		<description><![CDATA[&lt;p
&gt;Maxime: Oh! I hadn&#039;t considered splitting the one instance into two. I like the your solution&#039;s simplicity and that it avoids the GHC warnings. I suspect the constraint &lt;code
  &gt;Applicative (Vec n)&lt;/code
  &gt; would be cumbersome in practice.&lt;/p
&gt;

&lt;p
&gt;I think those warnings are due to a GHC bug.&lt;/p
&gt;

&lt;p
&gt;With the code I gave above, GHC 6.12.3 gives me a warning (with &lt;code
  &gt;-Wall&lt;/code
  &gt;, which I always use):&lt;/p
&gt;

&lt;pre
&gt;&lt;code
  &gt;Warning: Pattern match(es) are non-exhaustive
         In the definition of `&lt;*&gt;&#039;:
             Patterns not matched:
                 ZVec (_ :&lt; _)
                 (_ :&lt; _) ZVec
&lt;/code
  &gt;&lt;/pre
&gt;

&lt;p
&gt;Adding the following cases silences the compiler.&lt;/p
&gt;

&lt;pre class=&quot;sourceCode haskell&quot;
&gt;&lt;code
  &gt;&lt;span class=&quot;dt&quot;
    &gt;ZVec&lt;/span
    &gt; &lt;span class=&quot;ot&quot;
    &gt;`applyV`&lt;/span
    &gt; (_ &lt;span class=&quot;fu&quot;
    &gt;:&lt;&lt;/span
    &gt; _) &lt;span class=&quot;fu&quot;
    &gt;=&lt;/span
    &gt; &#8869;&lt;br
     /&gt;(_ &lt;span class=&quot;fu&quot;
    &gt;:&lt;&lt;/span
    &gt; _) &lt;span class=&quot;ot&quot;
    &gt;`applyV`&lt;/span
    &gt; &lt;span class=&quot;dt&quot;
    &gt;ZVec&lt;/span
    &gt; &lt;span class=&quot;fu&quot;
    &gt;=&lt;/span
    &gt; &#8869;&lt;br
     /&gt;&lt;/code
  &gt;&lt;/pre
&gt;

&lt;p
&gt;In &lt;a href=&quot;http://tunes.org/~nef/logs/haskell/11.01.30&quot;
  &gt;a chat on &lt;code
    &gt;#haskell&lt;/code
    &gt;&lt;/a
  &gt;, benmachine found that GHC 7.0.1 balks at these extra definitions as ill-typed, but also warns of non-exhaustive patterns when the lines are removed. In that chat, dafis pointed to a relevant &lt;a href=&quot;http://hackage.haskell.org/trac/ghc/ticket/3927&quot;
  &gt;ghc bug report&lt;/a
  &gt;.&lt;/p
&gt;
]]></description>
		<content:encoded><![CDATA[<p>Maxime: Oh! I hadn&#8217;t considered splitting the one instance into two. I like the your solution&#8217;s simplicity and that it avoids the GHC warnings. I suspect the constraint <code>Applicative (Vec n)</code> would be cumbersome in practice.</p>

<p>I think those warnings are due to a GHC bug.</p>

<p>With the code I gave above, GHC 6.12.3 gives me a warning (with <code>-Wall</code>, which I always use):</p>

<pre><code>Warning: Pattern match(es) are non-exhaustive
         In the definition of `&lt;*&gt;':
             Patterns not matched:
                 ZVec (_ :&lt; _)
                 (_ :&lt; _) ZVec
</code></pre>

<p>Adding the following cases silences the compiler.</p>

<pre class="sourceCode haskell"
><code><span class="dt"
    >ZVec</span> <span class="ot"
    >`applyV`</span> (_ <span class="fu"
    >:&lt;</span> _) <span class="fu"
    >=</span> &#8869;<br />(_ <span class="fu"
    >:&lt;</span> _) <span class="ot"
    >`applyV`</span> <span class="dt"
    >ZVec</span> <span class="fu"
    >=</span> &#8869;<br /></code></pre>

<p>In <a href="http://tunes.org/~nef/logs/haskell/11.01.30"
  >a chat on <code>#haskell</code></a>, benmachine found that GHC 7.0.1 balks at these extra definitions as ill-typed, but also warns of non-exhaustive patterns when the lines are removed. In that chat, dafis pointed to a relevant <a href="http://hackage.haskell.org/trac/ghc/ticket/3927"
  >ghc bug report</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-793</link>
		<dc:creator><![CDATA[conal]]></dc:creator>
		<pubDate>Sun, 30 Jan 2011 23:30:32 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-793</guid>
		<description><![CDATA[&lt;p&gt;Patai: yes, I have a solution that needs neither &lt;code&gt;FlexibleInstances&lt;/code&gt; nor &lt;code&gt;FlexibleContexts&lt;/code&gt;.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Patai: yes, I have a solution that needs neither <code>FlexibleInstances</code> nor <code>FlexibleContexts</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patai Gergely</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-792</link>
		<dc:creator><![CDATA[Patai Gergely]]></dc:creator>
		<pubDate>Sun, 30 Jan 2011 21:16:33 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-792</guid>
		<description><![CDATA[&lt;p&gt;Do you have a solution that doesn’t need FlexibleInstances and FlexibleContexts?&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>Do you have a solution that doesn’t need FlexibleInstances and FlexibleContexts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maxime Henrion</title>
		<link>http://conal.net/blog/posts/fixing-lists#comment-791</link>
		<dc:creator><![CDATA[Maxime Henrion]]></dc:creator>
		<pubDate>Sun, 30 Jan 2011 20:37:26 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=284#comment-791</guid>
		<description><![CDATA[&lt;p&gt;I&#039;m curious to know if I found the same solution as you did. Using the FlexibleContexts and FlexibleInstances extensions, I split the Applicative instance into two :&lt;/p&gt;

&lt;pre class=&quot;sourceCode haskell&quot;
&gt;&lt;code
  &gt;&lt;span class=&quot;kw&quot;
    &gt;instance&lt;/span
    &gt; &lt;span class=&quot;dt&quot;
    &gt;Applicative&lt;/span
    &gt; (&lt;span class=&quot;dt&quot;
    &gt;Vec&lt;/span
    &gt; &lt;span class=&quot;dt&quot;
    &gt;Z&lt;/span
    &gt;) &lt;span class=&quot;kw&quot;
    &gt;where&lt;/span
    &gt;&lt;br
     /&gt;  pure _ &lt;span class=&quot;fu&quot;
    &gt;=&lt;/span
    &gt; &lt;span class=&quot;dt&quot;
    &gt;Nil&lt;/span
    &gt;&lt;br
     /&gt;  &lt;span class=&quot;dt&quot;
    &gt;Nil&lt;/span
    &gt; &#8859; &lt;span class=&quot;dt&quot;
    &gt;Nil&lt;/span
    &gt; &lt;span class=&quot;fu&quot;
    &gt;=&lt;/span
    &gt; &lt;span class=&quot;dt&quot;
    &gt;Nil&lt;/span
    &gt;&lt;br
     /&gt;&lt;br
     /&gt;&lt;span class=&quot;kw&quot;
    &gt;instance&lt;/span
    &gt; &lt;span class=&quot;dt&quot;
    &gt;Applicative&lt;/span
    &gt; (&lt;span class=&quot;dt&quot;
    &gt;Vec&lt;/span
    &gt; n) &#8658; &lt;span class=&quot;dt&quot;
    &gt;Applicative&lt;/span
    &gt; (&lt;span class=&quot;dt&quot;
    &gt;Vec&lt;/span
    &gt; (&lt;span class=&quot;dt&quot;
    &gt;S&lt;/span
    &gt; n)) &lt;span class=&quot;kw&quot;
    &gt;where&lt;/span
    &gt;&lt;br
     /&gt;  pure x &lt;span class=&quot;fu&quot;
    &gt;=&lt;/span
    &gt; x &lt;span class=&quot;fu&quot;
    &gt;:&lt;&lt;/span
    &gt; pure x&lt;br
     /&gt;  (f &lt;span class=&quot;fu&quot;
    &gt;:&lt;&lt;/span
    &gt; fs) &lt;span class=&quot;fu&quot;
    &gt;&lt;&gt;&lt;/span
    &gt; (x &lt;span class=&quot;fu&quot;
    &gt;:&lt;&lt;/span
    &gt; xs) &lt;span class=&quot;fu&quot;
    &gt;=&lt;/span
    &gt; f x &lt;span class=&quot;fu&quot;
    &gt;:&lt;&lt;/span
    &gt; (fs &lt;span class=&quot;fu&quot;
    &gt;&lt;&gt;&lt;/span
    &gt; xs)&lt;br
     /&gt;&lt;/code
  &gt;&lt;/pre
&gt;

&lt;p&gt;This seems to work as expected. It is quite nice to see that GHC is now able to infer that both definitions of pure and &lt;code&gt;&lt;*&gt;&lt;/code&gt; are total, and doesn&#039;t generate any warning using &lt;code&gt;-Wall&lt;/code&gt; unlike with the definition of &lt;code&gt;&lt;*&gt;&lt;/code&gt; given in your post.&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m curious to know if I found the same solution as you did. Using the FlexibleContexts and FlexibleInstances extensions, I split the Applicative instance into two :</p>

<pre class="sourceCode haskell"
><code><span class="kw"
    >instance</span> <span class="dt"
    >Applicative</span> (<span class="dt"
    >Vec</span> <span class="dt"
    >Z</span>) <span class="kw"
    >where</span><br />  pure _ <span class="fu"
    >=</span> <span class="dt"
    >Nil</span><br />  <span class="dt"
    >Nil</span> &#8859; <span class="dt"
    >Nil</span> <span class="fu"
    >=</span> <span class="dt"
    >Nil</span><br /><br /><span class="kw"
    >instance</span> <span class="dt"
    >Applicative</span> (<span class="dt"
    >Vec</span> n) &#8658; <span class="dt"
    >Applicative</span> (<span class="dt"
    >Vec</span> (<span class="dt"
    >S</span> n)) <span class="kw"
    >where</span><br />  pure x <span class="fu"
    >=</span> x <span class="fu"
    >:&lt;</span> pure x<br />  (f <span class="fu"
    >:&lt;</span> fs) <span class="fu"
    >&lt;&gt;</span> (x <span class="fu"
    >:&lt;</span> xs) <span class="fu"
    >=</span> f x <span class="fu"
    >:&lt;</span> (fs <span class="fu"
    >&lt;&gt;</span> xs)<br /></code></pre>

<p>This seems to work as expected. It is quite nice to see that GHC is now able to infer that both definitions of pure and <code>&lt;*&gt;</code> are total, and doesn't generate any warning using <code>-Wall</code> unlike with the definition of <code>&lt;*&gt;</code> given in your post.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
