<?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: Another angle on functional future values</title>
	<atom:link href="http://conal.net/blog/posts/another-angle-on-functional-future-values/feed/" rel="self" type="application/rss+xml" />
	<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/</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; Exact numeric integration</title>
		<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/comment-page-1/#comment-34693</link>
		<dc:creator>Conal Elliott &#187; Blog Archive &#187; Exact numeric integration</dc:creator>
		<pubDate>Mon, 28 Dec 2009 18:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-34693</guid>
		<description>&lt;p&gt;[...] This benign-update idea is also explored in Another angle on functional future values. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] This benign-update idea is also explored in Another angle on functional future values. [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Patai Gergely</title>
		<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/comment-page-1/#comment-14352</link>
		<dc:creator>Patai Gergely</dc:creator>
		<pubDate>Mon, 19 Jan 2009 10:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-14352</guid>
		<description>&lt;p&gt;I&#039;ve been looking at this post for a while, but I still can&#039;t see why you need to add all this complexity. Couldn&#039;t you achieve the same thing by simply using an IORef that starts out as Nothing and is assigned exactly once, when the event actually fires?&lt;/p&gt;

&lt;p&gt;What exactly does your code do when you are trying to sample the far future? I don&#039;t understand where the magic future function comes from that can handle this case, but I assume this is what the (imperative?) framework should provide. And again, if we never want to sample with a future time, how is this different from an IORef after all and why is it better?&lt;/p&gt;

&lt;p&gt;Gergely&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been looking at this post for a while, but I still can&#8217;t see why you need to add all this complexity. Couldn&#8217;t you achieve the same thing by simply using an IORef that starts out as Nothing and is assigned exactly once, when the event actually fires?</p>

<p>What exactly does your code do when you are trying to sample the far future? I don&#8217;t understand where the magic future function comes from that can handle this case, but I assume this is what the (imperative?) framework should provide. And again, if we never want to sample with a future time, how is this different from an IORef after all and why is it better?</p>

<p>Gergely</p>]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/comment-page-1/#comment-13791</link>
		<dc:creator>conal</dc:creator>
		<pubDate>Tue, 06 Jan 2009 02:05:38 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-13791</guid>
		<description>&lt;p&gt;Ryan -- Yes.   See the link where I first mention SampleVar above.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ryan &#8212; Yes.   See the link where I first mention SampleVar above.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: conal</title>
		<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/comment-page-1/#comment-13780</link>
		<dc:creator>conal</dc:creator>
		<pubDate>Mon, 05 Jan 2009 21:59:35 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-13780</guid>
		<description>&lt;p&gt;Luke,&lt;/p&gt;

&lt;p&gt;Thanks for the great suggestion!  It also feeds very nicely into relative time:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;order :: Future a -&gt; Future a -&gt; Future &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;a, Future a&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;
order &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t,a&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;,b&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;
 &#124; t &lt;= t&#039;   = &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t,  &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;a, &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;-t, b&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;
 &#124; &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;otherwise&lt;/span&gt;&lt;/a&gt; = &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;, &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;b, &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t-t&#039;, a&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Then use this &lt;code&gt;order&lt;/code&gt; function to define &lt;code&gt;mappend&lt;/code&gt; on events (temporal interleaving).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Luke,</p>

<p>Thanks for the great suggestion!  It also feeds very nicely into relative time:</p>

<p><div>
<pre class="haskell">order :: Future a -&gt; Future a -&gt; Future <span style="color: green;">&#40;</span>a, Future a<span style="color: green;">&#41;</span>
order <span style="color: green;">&#40;</span>t,a<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>t',b<span style="color: green;">&#41;</span>
 | t &lt;= t'   = <span style="color: green;">&#40;</span>t,  <span style="color: green;">&#40;</span>a, <span style="color: green;">&#40;</span>t'-t, b<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span>
 | <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise" rel="nofollow"><span style="font-weight: bold;">otherwise</span></a> = <span style="color: green;">&#40;</span>t', <span style="color: green;">&#40;</span>b, <span style="color: green;">&#40;</span>t-t', a<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span><span style="color: green;">&#41;</span></pre>
</div></p>

<p>Then use this <code>order</code> function to define <code>mappend</code> on events (temporal interleaving).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Ingram</title>
		<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/comment-page-1/#comment-13779</link>
		<dc:creator>Ryan Ingram</dc:creator>
		<pubDate>Mon, 05 Jan 2009 21:50:06 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-13779</guid>
		<description>&lt;p&gt;Is &quot;SampleVar&quot; documented anywhere?  It&#039;s an abstraction I&#039;m unaware of at this moment.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Is &#8220;SampleVar&#8221; documented anywhere?  It&#8217;s an abstraction I&#8217;m unaware of at this moment.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Palmer</title>
		<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/comment-page-1/#comment-13773</link>
		<dc:creator>Luke Palmer</dc:creator>
		<pubDate>Mon, 05 Jan 2009 20:28:58 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-13773</guid>
		<description>&lt;p&gt;I still claim that you can and should encapsulate your Future representation by the use of the order combinator:&lt;/p&gt;

&lt;pre&gt;
order :: Future a -&gt; Future a -&gt; Future (a, Future a)
order (t,a) (t&#039;,b)
 &#124; t &lt;= t&#039;   = (t,  (a, (t&#039;, b)))
 &#124; otherwise = (t&#039;, (b, (t,  a)))
&lt;/pre&gt;

&lt;p&gt;So that the rest of the reactive code can be independent of your representation.&lt;/p&gt;

&lt;p&gt;Oh, and this looks like a nice lead, by the way.  :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I still claim that you can and should encapsulate your Future representation by the use of the order combinator:</p>

<pre>
order :: Future a -&gt; Future a -&gt; Future (a, Future a)
order (t,a) (t',b)
 | t &lt;= t'   = (t,  (a, (t', b)))
 | otherwise = (t', (b, (t,  a)))
</pre>

<p>So that the rest of the reactive code can be independent of your representation.</p>

<p>Oh, and this looks like a nice lead, by the way.  <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/another-angle-on-functional-future-values/comment-page-1/#comment-13770</link>
		<dc:creator>conal</dc:creator>
		<pubDate>Mon, 05 Jan 2009 18:47:38 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-13770</guid>
		<description>&lt;p&gt;Hi Creighton.  Thanks for the question.&lt;/p&gt;

&lt;p&gt;I think what makes these futures be absolute time is the use of the &lt;code&gt;Max&lt;/code&gt; monoid.  Switching to the &lt;code&gt;Sum&lt;/code&gt; monoid gives relative time.
Moreover, the definition of &lt;code&gt;until&lt;/code&gt; needs some tweaking.&lt;/p&gt;

&lt;p&gt;Absolute version:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;b `&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;until&lt;/span&gt;&lt;/a&gt;` Future &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;,b&#039;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; `at` t = b&#039;&#039; `at` t
 &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;where&lt;/span&gt;
   b&#039;&#039; = &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;if&lt;/span&gt; t &lt;= t&#039; &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;then&lt;/span&gt; b &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;else&lt;/span&gt; b&#039;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;The relative version has only a small change:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;b `&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;until&lt;/span&gt;&lt;/a&gt;` Future &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;,b&#039;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; `at` t = b&#039;&#039; `at` t
 &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;where&lt;/span&gt;
   b&#039;&#039; = &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;if&lt;/span&gt; t &lt;= t&#039; &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;then&lt;/span&gt; b &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;else&lt;/span&gt; pad t&#039; b&#039;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;where the &lt;code&gt;pad&lt;/code&gt; function prepends a segment of &#8869; to a behavior (or any &lt;code&gt;Segment&lt;/code&gt; type).  (For lists, &lt;code&gt;pad n == (repeat n undefined ++)&lt;/code&gt;.)&lt;/p&gt;

&lt;p&gt;Equivalently,&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;b `&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;until&lt;/span&gt;&lt;/a&gt;` Future &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;,b&#039;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; `at` t
  &#124; t &lt;= t&#039;   = b  `at` t
  &#124; &lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;otherwise&lt;/span&gt;&lt;/a&gt; = b&#039; `at` &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t - t&#039;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Using the ideas in &lt;em&gt;&lt;a href=&quot;http://conal.net/blog/posts/sequences-streams-and-segments/&quot; rel=&quot;nofollow&quot;&gt;Sequences, streams, and segments&lt;/a&gt;&lt;/em&gt; and in &lt;em&gt;&lt;a href=&quot;http://conal.net/blog/posts/sequences-segments-and-signals/&quot; rel=&quot;nofollow&quot;&gt;Sequences, segments, and signals&lt;/a&gt;&lt;/em&gt;, we get a much more elegant definition:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;b `&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;until&lt;/span&gt;&lt;/a&gt;` Future &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;,b&#039;&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:take&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;take&lt;/span&gt;&lt;/a&gt; t&#039; b `&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Monoid.html#v:mappend&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;mappend&lt;/span&gt;&lt;/a&gt;` b&#039;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;This formulation is what inspired those two blog posts and my renewed interest in relative time FRP.&lt;/p&gt;

&lt;p&gt;With function futures or caching futures, &lt;code&gt;until&lt;/code&gt; would look like the following for absolute time:&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;b `&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;until&lt;/span&gt;&lt;/a&gt;` u&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; `at` t = b&#039;&#039; `at` t
 &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;where&lt;/span&gt;
   b&#039;&#039; = &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;case&lt;/span&gt; tryFuture u t &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;of&lt;/span&gt;
           Nothing              -&gt; b
           Just &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;Future &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;_,b&#039;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; -&gt; b&#039;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;For relative time,&lt;/p&gt;

&lt;p&gt;&lt;div&gt;
&lt;pre class=&quot;haskell&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;b `&lt;a href=&quot;http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until&quot; rel=&quot;nofollow&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;until&lt;/span&gt;&lt;/a&gt;` u&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; `at` t = b&#039;&#039; `at` t
 &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;where&lt;/span&gt;
   b&#039;&#039; = &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;case&lt;/span&gt; tryFuture u t &lt;span style=&quot;color: #050; font-weight: bold;&quot;&gt;of&lt;/span&gt;
           Nothing               -&gt; b
           Just &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;Future &lt;span style=&quot;color: green;&quot;&gt;&#40;&lt;/span&gt;t&#039;,b&#039;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#41;&lt;/span&gt; -&gt; pad t&#039; b&#039;&lt;/pre&gt;
&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;I don&#039;t know how to extend the more elegant &lt;code&gt;take&lt;/code&gt;/&lt;code&gt;mappend&lt;/code&gt; version to use &lt;code&gt;tryFuture&lt;/code&gt;.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Creighton.  Thanks for the question.</p>

<p>I think what makes these futures be absolute time is the use of the <code>Max</code> monoid.  Switching to the <code>Sum</code> monoid gives relative time.
Moreover, the definition of <code>until</code> needs some tweaking.</p>

<p>Absolute version:</p>

<p><div>
<pre class="haskell"><span style="color: green;">&#40;</span>b `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until" rel="nofollow"><span style="font-weight: bold;">until</span></a>` Future <span style="color: green;">&#40;</span>t',b'<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> `at` t = b'' `at` t
 <span style="color: #050; font-weight: bold;">where</span>
   b'' = <span style="color: #050; font-weight: bold;">if</span> t &lt;= t' <span style="color: #050; font-weight: bold;">then</span> b <span style="color: #050; font-weight: bold;">else</span> b'</pre>
</div></p>

<p>The relative version has only a small change:</p>

<p><div>
<pre class="haskell"><span style="color: green;">&#40;</span>b `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until" rel="nofollow"><span style="font-weight: bold;">until</span></a>` Future <span style="color: green;">&#40;</span>t',b'<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> `at` t = b'' `at` t
 <span style="color: #050; font-weight: bold;">where</span>
   b'' = <span style="color: #050; font-weight: bold;">if</span> t &lt;= t' <span style="color: #050; font-weight: bold;">then</span> b <span style="color: #050; font-weight: bold;">else</span> pad t' b'</pre>
</div></p>

<p>where the <code>pad</code> function prepends a segment of &perp; to a behavior (or any <code>Segment</code> type).  (For lists, <code>pad n == (repeat n undefined ++)</code>.)</p>

<p>Equivalently,</p>

<p><div>
<pre class="haskell"><span style="color: green;">&#40;</span>b `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until" rel="nofollow"><span style="font-weight: bold;">until</span></a>` Future <span style="color: green;">&#40;</span>t',b'<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> `at` t
  | t &lt;= t'   = b  `at` t
  | <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:otherwise" rel="nofollow"><span style="font-weight: bold;">otherwise</span></a> = b' `at` <span style="color: green;">&#40;</span>t - t'<span style="color: green;">&#41;</span></pre>
</div></p>

<p>Using the ideas in <em><a href="http://conal.net/blog/posts/sequences-streams-and-segments/" rel="nofollow">Sequences, streams, and segments</a></em> and in <em><a href="http://conal.net/blog/posts/sequences-segments-and-signals/" rel="nofollow">Sequences, segments, and signals</a></em>, we get a much more elegant definition:</p>

<p><div>
<pre class="haskell">b `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until" rel="nofollow"><span style="font-weight: bold;">until</span></a>` Future <span style="color: green;">&#40;</span>t',b'<span style="color: green;">&#41;</span> = <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:take" rel="nofollow"><span style="font-weight: bold;">take</span></a> t' b `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Monoid.html#v:mappend" rel="nofollow"><span style="font-weight: bold;">mappend</span></a>` b'</pre>
</div></p>

<p>This formulation is what inspired those two blog posts and my renewed interest in relative time FRP.</p>

<p>With function futures or caching futures, <code>until</code> would look like the following for absolute time:</p>

<p><div>
<pre class="haskell"><span style="color: green;">&#40;</span>b `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until" rel="nofollow"><span style="font-weight: bold;">until</span></a>` u<span style="color: green;">&#41;</span> `at` t = b'' `at` t
 <span style="color: #050; font-weight: bold;">where</span>
   b'' = <span style="color: #050; font-weight: bold;">case</span> tryFuture u t <span style="color: #050; font-weight: bold;">of</span>
           Nothing              -&gt; b
           Just <span style="color: green;">&#40;</span>Future <span style="color: green;">&#40;</span>_,b'<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> -&gt; b'</pre>
</div></p>

<p>For relative time,</p>

<p><div>
<pre class="haskell"><span style="color: green;">&#40;</span>b `<a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:until" rel="nofollow"><span style="font-weight: bold;">until</span></a>` u<span style="color: green;">&#41;</span> `at` t = b'' `at` t
 <span style="color: #050; font-weight: bold;">where</span>
   b'' = <span style="color: #050; font-weight: bold;">case</span> tryFuture u t <span style="color: #050; font-weight: bold;">of</span>
           Nothing               -&gt; b
           Just <span style="color: green;">&#40;</span>Future <span style="color: green;">&#40;</span>t',b'<span style="color: green;">&#41;</span><span style="color: green;">&#41;</span> -&gt; pad t' b'</pre>
</div></p>

<p>I don&#8217;t know how to extend the more elegant <code>take</code>/<code>mappend</code> version to use <code>tryFuture</code>.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Creighton Hogg</title>
		<link>http://conal.net/blog/posts/another-angle-on-functional-future-values/comment-page-1/#comment-13761</link>
		<dc:creator>Creighton Hogg</dc:creator>
		<pubDate>Mon, 05 Jan 2009 15:24:46 +0000</pubDate>
		<guid isPermaLink="false">http://conal.net/blog/?p=73#comment-13761</guid>
		<description>&lt;p&gt;Thanks for writing these ideas up.
A quick question, though:  it seems like this definition of Futures really only makes sense for absolute time?&lt;/p&gt;

&lt;p&gt;Also, I understand why it&#039;s okay to use unsafePerformIO here but it still makes me a little squeamish.  I don&#039;t trust myself with that abstraction-breaking hammer yet.  :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for writing these ideas up.
A quick question, though:  it seems like this definition of Futures really only makes sense for absolute time?</p>

<p>Also, I understand why it&#8217;s okay to use unsafePerformIO here but it still makes me a little squeamish.  I don&#8217;t trust myself with that abstraction-breaking hammer yet.  <img src='http://conal.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
</channel>
</rss>
