<?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: Elegant memoization with functional memo tries</title>
	<atom:link href="http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/feed/" rel="self" type="application/rss+xml" />
	<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/</link>
	<description>Inspirations &#38; experiments, mainly about denotational programming in Haskell</description>
	<lastBuildDate>Tue, 16 Mar 2010 20:14:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Memoizing polymorphic functions - part two</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-32215</link>
		<dc:creator>Conal Elliott &#187; Blog Archive &#187; Memoizing polymorphic functions - part two</dc:creator>
		<pubDate>Fri, 20 Nov 2009 19:33:26 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-32215</guid>
		<description>&lt;p&gt;[...] Comments conal on Elegant memoization with functional memo triesShawn Willden on Elegant memoization with functional memo triesDave Crossland on Seeking advice on [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Comments conal on Elegant memoization with functional memo triesShawn Willden on Elegant memoization with functional memo triesDave Crossland on Seeking advice on [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-31832</link>
		<dc:creator>conal</dc:creator>
		<pubDate>Sat, 14 Nov 2009 19:22:02 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-31832</guid>
		<description>&lt;p&gt;@Shawn -- Fixed now.  Thanks for the note.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Shawn &#8212; Fixed now.  Thanks for the note.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn Willden</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-31813</link>
		<dc:creator>Shawn Willden</dc:creator>
		<pubDate>Sat, 14 Nov 2009 07:13:13 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-31813</guid>
		<description>&lt;p&gt;Your source code links are broken.  Could you please fix them so I can understand what it is you&#039;re talking about?  Thanks.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Your source code links are broken.  Could you please fix them so I can understand what it is you&#8217;re talking about?  Thanks.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Memoizing polymorphic functions - part one</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-22207</link>
		<dc:creator>Conal Elliott &#187; Blog Archive &#187; Memoizing polymorphic functions - part one</dc:creator>
		<pubDate>Thu, 11 Jun 2009 00:36:40 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-22207</guid>
		<description>&lt;p&gt;[...] reuses rather than recomputes when applied to the same argument more than once. Variations include not-quite-equivalence due to added strictness, and replacing value equality with pointer [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] reuses rather than recomputes when applied to the same argument more than once. Variations include not-quite-equivalence due to added strictness, and replacing value equality with pointer [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Simpler, more efficient, functional linear maps</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-11163</link>
		<dc:creator>Conal Elliott &#187; Blog Archive &#187; Simpler, more efficient, functional linear maps</dc:creator>
		<pubDate>Sun, 09 Nov 2008 22:16:12 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-11163</guid>
		<description>&lt;p&gt;[...] However, there are several other ways to make linear maps, and it would be easy to forget to memoize each combining form. So, instead of the function representation above, I ensure that the function be memoized by representing it as a memo trie. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] However, there are several other ways to make linear maps, and it would be easy to forget to memoize each combining form. So, instead of the function representation above, I ensure that the function be memoized by representing it as a memo trie. [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Vector space bases via type families</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10304</link>
		<dc:creator>Conal Elliott &#187; Blog Archive &#187; Vector space bases via type families</dc:creator>
		<pubDate>Mon, 20 Oct 2008 01:23:36 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10304</guid>
		<description>&lt;p&gt;[...] rules are also essentially the same as the ones used for memo tries, but phrased in terms of logarithms instead of (explicit) exponents.    Tags: type families, vector [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] rules are also essentially the same as the ones used for memo tries, but phrased in terms of logarithms instead of (explicit) exponents.    Tags: type families, vector [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10190</link>
		<dc:creator>conal</dc:creator>
		<pubDate>Thu, 16 Oct 2008 23:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10190</guid>
		<description>&lt;p&gt;I said to &lt;a href=&quot;http://luqui.org/blog&quot; rel=&quot;nofollow&quot;&gt;Luke&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
I&#039;d love to read a blog post about your library, especially where you exploit the flexibility of explicit memoizers.
&lt;/blockquote&gt;

&lt;p&gt;Oh!  Now I see that you &lt;a href=&quot;http://luqui.org/blog/archives/2008/10/14/data-memocombinators/&quot; rel=&quot;nofollow&quot;&gt;have written&lt;/a&gt;.  I&#039;d still like to see some nice examples if you get around to it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I said to <a href="http://luqui.org/blog" rel="nofollow">Luke</a></p>

<blockquote>
I&#8217;d love to read a blog post about your library, especially where you exploit the flexibility of explicit memoizers.
</blockquote>

<p>Oh!  Now I see that you <a href="http://luqui.org/blog/archives/2008/10/14/data-memocombinators/" rel="nofollow">have written</a>.  I&#8217;d still like to see some nice examples if you get around to it.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Menendez</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10187</link>
		<dc:creator>Dave Menendez</dc:creator>
		<pubDate>Thu, 16 Oct 2008 21:27:21 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10187</guid>
		<description>&lt;blockquote&gt;
  &lt;p&gt;Any thoughts on this dilemma?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well, there&#039;s not much point memoizing a constant function. Also, a strict instance for () is more consistent with the other instances.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<blockquote>
  <p>Any thoughts on this dilemma?</p>
</blockquote>

<p>Well, there&#8217;s not much point memoizing a constant function. Also, a strict instance for () is more consistent with the other instances.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10183</link>
		<dc:creator>conal</dc:creator>
		<pubDate>Thu, 16 Oct 2008 17:21:31 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10183</guid>
		<description>&lt;blockquote&gt;
  &lt;p&gt;[...] I don&#039;t think the typeclass approach to memoization is a good one. Here you are limited to one memo trie per type. But there are many ways to memoize a given type!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yep.  A problem with typeclasses in general.  Even more generally, a problem with hiding implementation mechanism.  Prettier but less flexible.  I gather you&#039;ve found the flexibility particularly useful with memoization.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;data-memocombinators, which I just released on hackage two days ago [...]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sounds awfully cool.  I&#039;d love to read a blog post about your library, especially where you exploit the flexibility of explicit memoizers.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<blockquote>
  <p>[...] I don&#8217;t think the typeclass approach to memoization is a good one. Here you are limited to one memo trie per type. But there are many ways to memoize a given type!</p>
</blockquote>

<p>Yep.  A problem with typeclasses in general.  Even more generally, a problem with hiding implementation mechanism.  Prettier but less flexible.  I gather you&#8217;ve found the flexibility particularly useful with memoization.</p>

<blockquote>
  <p>data-memocombinators, which I just released on hackage two days ago [...]</p>
</blockquote>

<p>Sounds awfully cool.  I&#8217;d love to read a blog post about your library, especially where you exploit the flexibility of explicit memoizers.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10182</link>
		<dc:creator>conal</dc:creator>
		<pubDate>Thu, 16 Oct 2008 17:11:11 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10182</guid>
		<description>&lt;blockquote&gt;
Memoization changes the strictness of functions.
&lt;/blockquote&gt;

&lt;p&gt;Yow!  It sure does.  :(&lt;/p&gt;

&lt;blockquote&gt;
this one is not essential, but rather a bug, I think.
&lt;/blockquote&gt;

&lt;p&gt;Oh, I see the problem:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&gt; &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;let&lt;/span&gt; f &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; = &lt;span style=&quot;color: red;&quot;&gt;42&lt;/span&gt;
&gt; &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;\ &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; -&gt; &lt;span style=&quot;color: red;&quot;&gt;42&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;undefined&lt;/span&gt;&lt;/a&gt; 
*** Exception: &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;colo: #050; font-weight: bold;&quot;&gt;Prelude&lt;/span&gt;&lt;/a&gt;.&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;undefined&lt;/span&gt;&lt;/a&gt;
&gt; &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:const&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;const&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: red;&quot;&gt;42&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;undefined&lt;/span&gt;&lt;/a&gt; 
&lt;span style=&quot;color: red;&quot;&gt;42&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Hmm.  I can fix the &lt;code&gt;f&lt;/code&gt; case by changing the nonstrict &lt;code&gt;const a&lt;/code&gt; to the strict &lt;code&gt;\ () -&gt; a&lt;/code&gt; in the definition of &lt;code&gt;untrie (UnitTrie a)&lt;/code&gt;.  But then I run into the dual problem:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&gt; &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;let&lt;/span&gt; g = &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:const&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;const&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: red;&quot;&gt;42&lt;/span&gt; :: &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; -&gt; &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;color: #833; font-weight: bold;&quot;&gt;Int&lt;/span&gt;&lt;/a&gt;
&gt; g &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;undefined&lt;/span&gt;&lt;/a&gt;
&lt;span style=&quot;color: red;&quot;&gt;42&lt;/span&gt;
&gt; memo g &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;undefined&lt;/span&gt;&lt;/a&gt;
*** Exception: &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;colo: #050; font-weight: bold;&quot;&gt;Prelude&lt;/span&gt;&lt;/a&gt;.&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;undefined&lt;/span&gt;&lt;/a&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Any thoughts on this dilemma?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<blockquote>
Memoization changes the strictness of functions.
</blockquote>

<p>Yow!  It sure does.  <img src='http://conal.net/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>

<blockquote>
this one is not essential, but rather a bug, I think.
</blockquote>

<p>Oh, I see the problem:</p>

<p><div>
<pre class="haskell">&gt; <span style="color: #050; font-weight: bold;">let</span> f <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> = <span style="color: red;">42</span>
&gt; <span style="color: green;">&#40;</span>\ <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> -&gt; <span style="color: red;">42</span><span style="color: green;">&#41;</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined" rel="nofollow"><span style="font-weight: bold;">undefined</span></a> 
*** Exception: <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html" rel="nofollow"><span style="colo: #050; font-weight: bold;">Prelude</span></a>.<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined" rel="nofollow"><span style="font-weight: bold;">undefined</span></a>
&gt; <span style="color: green;">&#40;</span><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:const" rel="nofollow"><span style="font-weight: bold;">const</span></a> <span style="color: red;">42</span><span style="color: green;">&#41;</span> <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined" rel="nofollow"><span style="font-weight: bold;">undefined</span></a> 
<span style="color: red;">42</span></pre>
</div></p>

<p>Hmm.  I can fix the <code>f</code> case by changing the nonstrict <code>const a</code> to the strict <code>\ () -&gt; a</code> in the definition of <code>untrie (UnitTrie a)</code>.  But then I run into the dual problem:</p>

<p><div>
<pre class="haskell">&gt; <span style="color: #050; font-weight: bold;">let</span> g = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:const" rel="nofollow"><span style="font-weight: bold;">const</span></a> <span style="color: red;">42</span> :: <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span> -&gt; <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Int" rel="nofollow"><span style="color: #833; font-weight: bold;">Int</span></a>
&gt; g <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined" rel="nofollow"><span style="font-weight: bold;">undefined</span></a>
<span style="color: red;">42</span>
&gt; memo g <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined" rel="nofollow"><span style="font-weight: bold;">undefined</span></a>
*** Exception: <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html" rel="nofollow"><span style="colo: #050; font-weight: bold;">Prelude</span></a>.<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:undefined" rel="nofollow"><span style="font-weight: bold;">undefined</span></a></pre>
</div></p>

<p>Any thoughts on this dilemma?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Palmer</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10166</link>
		<dc:creator>Luke Palmer</dc:creator>
		<pubDate>Thu, 16 Oct 2008 08:42:43 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10166</guid>
		<description>&lt;p&gt;Oh, your semantics are not quite right.  Memoization changes the strictness of functions.&lt;/p&gt;

&lt;pre&gt;
    take 5 (repeat True)        = [True,True,True,True,True]
    memo (take 5) (repeat True) = &#8869;
    
    -- this one is not essential, but rather a bug, I think.
    let f () = 42
    f &#8869;      = &#8869;
    memo f &#8869; = 42
&lt;/pre&gt;

&lt;p&gt;I am not quite sure in what essential way the strictness is changed.  For example, it is theoretically possible to memoize a function of infinite streams, given that the return type is compact, so it&#039;s not just that it makes it fully strict in its argument&#039;s domain.  I haven&#039;t gotten around to implementing this awesome possibility just yet :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Oh, your semantics are not quite right.  Memoization changes the strictness of functions.</p>

<pre>
    take 5 (repeat True)        = [True,True,True,True,True]
    memo (take 5) (repeat True) = &perp;
    
    -- this one is not essential, but rather a bug, I think.
    let f () = 42
    f &perp;      = &perp;
    memo f &perp; = 42
</pre>

<p>I am not quite sure in what essential way the strictness is changed.  For example, it is theoretically possible to memoize a function of infinite streams, given that the return type is compact, so it&#8217;s not just that it makes it fully strict in its argument&#8217;s domain.  I haven&#8217;t gotten around to implementing this awesome possibility just yet <img src='http://conal.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Palmer</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10164</link>
		<dc:creator>Luke Palmer</dc:creator>
		<pubDate>Thu, 16 Oct 2008 08:29:07 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10164</guid>
		<description>&lt;p&gt;We will see where you are going this, but I have two comments.&lt;/p&gt;

&lt;p&gt;(1) So far, I don&#039;t believe associated types are necessary. HasMemo should be implementable with the simple interface:&lt;/p&gt;

&lt;pre&gt;
class HasMemo a where
    memo :: (a -&gt; r) -&gt; (a -&gt; r)
&lt;/pre&gt;

&lt;p&gt;All the compositions you have used, and every other composition I have been able to think of, are implementable with this structure.&lt;/p&gt;

&lt;p&gt;(2) This one is more subjective, but I don&#039;t think the typeclass approach to memoization is a good one.  Here you are limited to one memo trie per type.  But there are many ways to memoize a given type!  Indeed, you could use newtypes, but that&#039;s clunky and a lot of work.  data-memocombinators, which I just released on hackage two days ago (uh... are you and I the same person? :-), exposes memoizers as first-class functions so that they can be custom built; i.e. so you can memoize only integers less than 1,000,000 (the best way to solve one of the Euler problems), or only memoize the Left side of an Either (let&#039;s say the right doesn&#039;t have a trie), etc.&lt;/p&gt;

&lt;p&gt;I think competition on Hackage will be nice, to see which approach ends up being more useful.  The two approaches can be trivially combined by picking a default memoizer for each type.  I wonder if there is a deeper, more flexible way to combine them.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>We will see where you are going this, but I have two comments.</p>

<p>(1) So far, I don&#8217;t believe associated types are necessary. HasMemo should be implementable with the simple interface:</p>

<pre>
class HasMemo a where
    memo :: (a -&gt; r) -&gt; (a -&gt; r)
</pre>

<p>All the compositions you have used, and every other composition I have been able to think of, are implementable with this structure.</p>

<p>(2) This one is more subjective, but I don&#8217;t think the typeclass approach to memoization is a good one.  Here you are limited to one memo trie per type.  But there are many ways to memoize a given type!  Indeed, you could use newtypes, but that&#8217;s clunky and a lot of work.  data-memocombinators, which I just released on hackage two days ago (uh&#8230; are you and I the same person? <img src='http://conal.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> , exposes memoizers as first-class functions so that they can be custom built; i.e. so you can memoize only integers less than 1,000,000 (the best way to solve one of the Euler problems), or only memoize the Left side of an Either (let&#8217;s say the right doesn&#8217;t have a trie), etc.</p>

<p>I think competition on Hackage will be nice, to see which approach ends up being more useful.  The two approaches can be trivially combined by picking a default memoizer for each type.  I wonder if there is a deeper, more flexible way to combine them.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Conal Elliott &#187; Blog Archive &#187; Composing memo tries</title>
		<link>http://conal.net/blog/posts/elegant-memoization-with-functional-memo-tries/comment-page-1/#comment-10148</link>
		<dc:creator>Conal Elliott &#187; Blog Archive &#187; Composing memo tries</dc:creator>
		<pubDate>Thu, 16 Oct 2008 02:18:17 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=54#comment-10148</guid>
		<description>&lt;p&gt;[...] About      &#171; Elegant memoization with functional memo tries [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] About      &laquo; Elegant memoization with functional memo tries [...]</p>]]></content:encoded>
	</item>
</channel>
</rss>
