<?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: any with foldr</title>
	<atom:link href="http://www.elharo.com/blog/software-development/haskell/2009/01/23/any-with-foldr/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elharo.com/blog/software-development/haskell/2009/01/23/any-with-foldr/</link>
	<description>Ranting and Raving</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:38:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Matt</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/01/23/any-with-foldr/comment-page-1/#comment-688656</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Tue, 24 Feb 2009 22:12:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002051#comment-688656</guid>
		<description>Agreed that there is redundancy that helps humans to understand, but there is redundancy that makes things harder to understand, e.g. Java&#039;s painful constructs like:


   Map&lt;String, List&gt; map = new HashMap&lt;String, List();


The thing I like about type inference is that I get the option, as a programmer, to give the types when I think it would be most helpful for others reading the program. At the least, in Haskell, it certainly makes a lot of sense (and I believe is a widely adopted best practice?) to annotate at least the top-level functions of a program with explicit types. Something that would help with Haskell is an editor/IDE with the feature that you can highlight any subexpression, and it would show you the inferred type of that subexpression (I don&#039;t know of any, though.)</description>
		<content:encoded><![CDATA[<p>Agreed that there is redundancy that helps humans to understand, but there is redundancy that makes things harder to understand, e.g. Java&#8217;s painful constructs like:</p>
<p>   Map&lt;String, List&gt; map = new HashMap&lt;String, List();</p>
<p>The thing I like about type inference is that I get the option, as a programmer, to give the types when I think it would be most helpful for others reading the program. At the least, in Haskell, it certainly makes a lot of sense (and I believe is a widely adopted best practice?) to annotate at least the top-level functions of a program with explicit types. Something that would help with Haskell is an editor/IDE with the feature that you can highlight any subexpression, and it would show you the inferred type of that subexpression (I don&#8217;t know of any, though.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/01/23/any-with-foldr/comment-page-1/#comment-646248</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 24 Jan 2009 22:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002051#comment-646248</guid>
		<description>What about this?

myAny :: (a -&gt; Bool) -&gt; [a] -&gt; Bool
myAny f xs = foldr step False xs
     where step x acc = acc &#124;&#124; f x</description>
		<content:encoded><![CDATA[<p>What about this?</p>
<p>myAny :: (a -&gt; Bool) -&gt; [a] -&gt; Bool<br />
myAny f xs = foldr step False xs<br />
     where step x acc = acc || f x</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elliotte Rusty Harold</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/01/23/any-with-foldr/comment-page-1/#comment-646000</link>
		<dc:creator>Elliotte Rusty Harold</dc:creator>
		<pubDate>Sat, 24 Jan 2009 14:45:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002051#comment-646000</guid>
		<description>Yep, it&#039;s buggy. Here&#039;s a fixed version:

&lt;pre&gt;myAny :: (a -&gt; Bool) -&gt; [a] -&gt; Bool
myAny f [] = False
myAny f (x:xs) = foldr step (f x) xs
     where step x acc = acc &#124;&#124; f x&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Yep, it&#8217;s buggy. Here&#8217;s a fixed version:</p>
<pre>myAny :: (a -> Bool) -> [a] -> Bool
myAny f [] = False
myAny f (x:xs) = foldr step (f x) xs
     where step x acc = acc || f x</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Day</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/01/23/any-with-foldr/comment-page-1/#comment-645691</link>
		<dc:creator>Michael Day</dc:creator>
		<pubDate>Sat, 24 Jan 2009 04:01:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002051#comment-645691</guid>
		<description>Right, myAny does not need to do pattern matching on the list, it can just pass it to foldr.
I agree regarding type inference: explicit type declarations give the programmer a chance to state their intent and act as documentation for those who come after. Type inference for local variables is a big time saver though, especially compared to the classic Java pattern:StupidFactory stupidFactory = new StupidFactory();</description>
		<content:encoded><![CDATA[<p>Right, myAny does not need to do pattern matching on the list, it can just pass it to foldr.<br />
I agree regarding type inference: explicit type declarations give the programmer a chance to state their intent and act as documentation for those who come after. Type inference for local variables is a big time saver though, especially compared to the classic Java pattern:StupidFactory stupidFactory = new StupidFactory();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.elharo.com/blog/software-development/haskell/2009/01/23/any-with-foldr/comment-page-1/#comment-645622</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 24 Jan 2009 01:05:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.elharo.com/blog/?p=1002051#comment-645622</guid>
		<description>I haven&#039;t run it, but I&#039;m pretty sure your definition has a bug: it ignores the first element of the list.</description>
		<content:encoded><![CDATA[<p>I haven&#8217;t run it, but I&#8217;m pretty sure your definition has a bug: it ignores the first element of the list.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

