<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Fusion makes functional programming fun!</title>
	<atom:link href="http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/feed/" rel="self" type="application/rss+xml" />
	<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/</link>
	<description>A Journal of Haskell Programming</description>
	<lastBuildDate>Mon, 03 Oct 2011 02:09:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Top Posts &#8212; WordPress.com</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-376</link>
		<dc:creator><![CDATA[Top Posts &#8212; WordPress.com]]></dc:creator>
		<pubDate>Tue, 02 Mar 2010 00:08:46 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-376</guid>
		<description><![CDATA[[...]  Fusion makes functional programming fun! It&#8217;s deeply satisfying when the stream fusion optimization kicks in, in GHC Haskell. It is a powerful [...] [...]]]></description>
		<content:encoded><![CDATA[<p>[...]  Fusion makes functional programming fun! It&#8217;s deeply satisfying when the stream fusion optimization kicks in, in GHC Haskell. It is a powerful [...] [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dons00</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-371</link>
		<dc:creator><![CDATA[dons00]]></dc:creator>
		<pubDate>Mon, 01 Mar 2010 16:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-371</guid>
		<description><![CDATA[I meant more that allocating a strict array like this will kill performance, unless you swtich to lazy sequences (or have a deforestation pass).]]></description>
		<content:encoded><![CDATA[<p>I meant more that allocating a strict array like this will kill performance, unless you swtich to lazy sequences (or have a deforestation pass).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-369</link>
		<dc:creator><![CDATA[Peter]]></dc:creator>
		<pubDate>Mon, 01 Mar 2010 14:03:34 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-369</guid>
		<description><![CDATA[In paragraph 4 you mention &quot;Try doing that in your favorite strict language&quot;. The reason you can fuse is purity, not evaluation strategy. The reason pure languages allow us to fuse is because the only observable effect (non-termination) is commutative, so computations can effectively be reordered in programs without observable differences.]]></description>
		<content:encoded><![CDATA[<p>In paragraph 4 you mention &#8220;Try doing that in your favorite strict language&#8221;. The reason you can fuse is purity, not evaluation strategy. The reason pure languages allow us to fuse is because the only observable effect (non-termination) is commutative, so computations can effectively be reordered in programs without observable differences.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Orphi</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-368</link>
		<dc:creator><![CDATA[Orphi]]></dc:creator>
		<pubDate>Mon, 01 Mar 2010 12:09:28 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-368</guid>
		<description><![CDATA[Is that the ghc-core tool that doesn&#039;t work on Windows?

I find fusion very exciting also. I just wish it wasn&#039;t so hard to figure out whether it&#039;s happening or not. ;-)]]></description>
		<content:encoded><![CDATA[<p>Is that the ghc-core tool that doesn&#8217;t work on Windows?</p>
<p>I find fusion very exciting also. I just wish it wasn&#8217;t so hard to figure out whether it&#8217;s happening or not. ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evolving Faster Haskell Programs (now with LLVM!) &#171; Control.Monad.Writer</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-357</link>
		<dc:creator><![CDATA[Evolving Faster Haskell Programs (now with LLVM!) &#171; Control.Monad.Writer]]></dc:creator>
		<pubDate>Mon, 01 Mar 2010 07:55:40 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-357</guid>
		<description><![CDATA[[...] warm up, and see if this stuff works, I&#8217;ll begin with the toy program from last week&#8217;s fusion post. There, GHC fuses two loops into one, but it fails to collapse [...]]]></description>
		<content:encoded><![CDATA[<p>[...] warm up, and see if this stuff works, I&#8217;ll begin with the toy program from last week&#8217;s fusion post. There, GHC fuses two loops into one, but it fails to collapse [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-353</link>
		<dc:creator><![CDATA[Evan]]></dc:creator>
		<pubDate>Mon, 01 Mar 2010 03:48:02 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-353</guid>
		<description><![CDATA[Fusion seems nice in theory, but never seems to be applicable to situations in my programs.  I often have pipelines of operations, but they are rarely combined with direct composition.

For example, I have a program that would seem to be an ideal candidate for fusion.  I have lots of arrays that get added to other arrays, multiplied by constants, mapped over by transformers, etc.

However, this is a kind of EDSL where the arrays are stored in an environment (a StateT basically acting as a Reader).  They get pulled out, manipulated, and put back in to dynamically scope over the called code.

E.g.

-- ignoring the possibility of Nothing from Map.lookup
a = local (Map.insert &quot;sig&quot; . Vector.map (*2) . Map.lookup &quot;sig&quot;) b
b = local (Map.insert &quot;sig&quot; . Vector.map (/2) . Map.lookup &quot;sig&quot;) c
c = ...

I&#039;m pretty sure in this case the two maps won&#039;t fuse since GHC would have to figure out that from the point of view of &#039;c&#039;, the intermediate vector created by &#039;a&#039; is not needed.

I have thought of storing the environment not as (Map String Vector) but as (Map String ([Vector -&gt; Vector], Vector]).  Then when someone actually wants the value of a vector, they pull it out and do a &#039;foldr (.) id funcs vec&#039;.  That would avoid intermediate vectors at the cost of duplicated computation if the intermediate vector is used after all.

But I&#039;m not sure that would fuse either, since I don&#039;t know if rules will kick in when the functions are in a list like that.

Ideas?  Advice?  I&#039;m curious about the limitations of fusion and how one can structure a program to expose more things to it.

Of course this sort of defeats the purpose of &quot;write naturally and the compiler will make it fast&quot;, but jumping through a few composition hoops would still be easier than manual fusion.  Or would it?  What if I store [Either (Int -&gt; Int) (Vector -&gt; Vector)], then manually fuse adjacent Lefts?]]></description>
		<content:encoded><![CDATA[<p>Fusion seems nice in theory, but never seems to be applicable to situations in my programs.  I often have pipelines of operations, but they are rarely combined with direct composition.</p>
<p>For example, I have a program that would seem to be an ideal candidate for fusion.  I have lots of arrays that get added to other arrays, multiplied by constants, mapped over by transformers, etc.</p>
<p>However, this is a kind of EDSL where the arrays are stored in an environment (a StateT basically acting as a Reader).  They get pulled out, manipulated, and put back in to dynamically scope over the called code.</p>
<p>E.g.</p>
<p>&#8211; ignoring the possibility of Nothing from Map.lookup<br />
a = local (Map.insert &#8220;sig&#8221; . Vector.map (*2) . Map.lookup &#8220;sig&#8221;) b<br />
b = local (Map.insert &#8220;sig&#8221; . Vector.map (/2) . Map.lookup &#8220;sig&#8221;) c<br />
c = &#8230;</p>
<p>I&#8217;m pretty sure in this case the two maps won&#8217;t fuse since GHC would have to figure out that from the point of view of &#8216;c&#8217;, the intermediate vector created by &#8216;a&#8217; is not needed.</p>
<p>I have thought of storing the environment not as (Map String Vector) but as (Map String ([Vector -&gt; Vector], Vector]).  Then when someone actually wants the value of a vector, they pull it out and do a &#8216;foldr (.) id funcs vec&#8217;.  That would avoid intermediate vectors at the cost of duplicated computation if the intermediate vector is used after all.</p>
<p>But I&#8217;m not sure that would fuse either, since I don&#8217;t know if rules will kick in when the functions are in a list like that.</p>
<p>Ideas?  Advice?  I&#8217;m curious about the limitations of fusion and how one can structure a program to expose more things to it.</p>
<p>Of course this sort of defeats the purpose of &#8220;write naturally and the compiler will make it fast&#8221;, but jumping through a few composition hoops would still be easier than manual fusion.  Or would it?  What if I store [Either (Int -&gt; Int) (Vector -&gt; Vector)], then manually fuse adjacent Lefts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Nilsson</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-350</link>
		<dc:creator><![CDATA[John Nilsson]]></dc:creator>
		<pubDate>Sun, 28 Feb 2010 16:38:03 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-350</guid>
		<description><![CDATA[@Brett We are already way beyond humans being able to comprehend the performance of a piece of code. Compiler optimizations or not.

Even if the code perfectly represents the steps the CPU would take you still has to consider the effect of cache misses and other hard to predict realities of the execution context.

So just let it go. Assume the code will be optimized as good as theoretically possible by the compiler and runtime and focus on making it as readable and maintainable as possible instead.]]></description>
		<content:encoded><![CDATA[<p>@Brett We are already way beyond humans being able to comprehend the performance of a piece of code. Compiler optimizations or not.</p>
<p>Even if the code perfectly represents the steps the CPU would take you still has to consider the effect of cache misses and other hard to predict realities of the execution context.</p>
<p>So just let it go. Assume the code will be optimized as good as theoretically possible by the compiler and runtime and focus on making it as readable and maintainable as possible instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dons00</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-347</link>
		<dc:creator><![CDATA[dons00]]></dc:creator>
		<pubDate>Sat, 27 Feb 2010 04:35:14 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-347</guid>
		<description><![CDATA[Thanks Chris. That&#039;s gratifying!]]></description>
		<content:encoded><![CDATA[<p>Thanks Chris. That&#8217;s gratifying!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Heller</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-345</link>
		<dc:creator><![CDATA[Chris Heller]]></dc:creator>
		<pubDate>Sat, 27 Feb 2010 03:33:06 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-345</guid>
		<description><![CDATA[Thanks for the clarification. That is really quite a powerful feature, I see why you are so excited about it.

I want to personally encourage you to keep writing these posts about GHC. My day job lands my thoughts square in the land of C, but whenever one of these posts makes it on to the news aggregator sites I find myself breaking out GHCi yet again.

Hopefully one of these days I won&#039;t have to put it away.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the clarification. That is really quite a powerful feature, I see why you are so excited about it.</p>
<p>I want to personally encourage you to keep writing these posts about GHC. My day job lands my thoughts square in the land of C, but whenever one of these posts makes it on to the news aggregator sites I find myself breaking out GHCi yet again.</p>
<p>Hopefully one of these days I won&#8217;t have to put it away.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dons00</title>
		<link>http://donsbot.wordpress.com/2010/02/26/fusion-makes-functional-programming-fun/#comment-344</link>
		<dc:creator><![CDATA[dons00]]></dc:creator>
		<pubDate>Sat, 27 Feb 2010 01:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://donsbot.wordpress.com/?p=460#comment-344</guid>
		<description><![CDATA[Fusion is tied to particular sequence types. The vector library is the best example, as it is built soley from fusible functions. This is mentioned on the main page: http://hackage.haskell.org/package/vector 

In general, if you&#039;re using vector you don&#039;t need to care about fusion -- since it&#039;s all designed that way (same for the existing fusion mechanisms for lists).

Now, if you&#039;re really interested (say you&#039;re doing some high performance numerics), then you&#039;d use a tool like ghc-core to watch for fusion sites. GHC will let you know what it finds.]]></description>
		<content:encoded><![CDATA[<p>Fusion is tied to particular sequence types. The vector library is the best example, as it is built soley from fusible functions. This is mentioned on the main page: <a href="http://hackage.haskell.org/package/vector" rel="nofollow">http://hackage.haskell.org/package/vector</a> </p>
<p>In general, if you&#8217;re using vector you don&#8217;t need to care about fusion &#8212; since it&#8217;s all designed that way (same for the existing fusion mechanisms for lists).</p>
<p>Now, if you&#8217;re really interested (say you&#8217;re doing some high performance numerics), then you&#8217;d use a tool like ghc-core to watch for fusion sites. GHC will let you know what it finds.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
