<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>heisenbug - Comments</title>
    <link>http://www.heisenbug.info/</link>
    <description>heisenbug - Perl, Scala and more</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    <pubDate>Sun, 19 May 2013 21:07:06 GMT</pubDate>

    <image>
        <url>http://www.heisenbug.info/templates/competition/img/s9y_banner_small.png</url>
        <title>RSS: heisenbug - Comments - heisenbug - Perl, Scala and more</title>
        <link>http://www.heisenbug.info/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Derek Williams: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c493</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (Derek Williams)</author>
    <content:encoded>
    &lt;p&gt;Fixed now in Akka. I knew I had compile time type safety with this before, I accidently removed it during a refactoring. Added a test for it now too. If it wasn&#039;t for this blog post I wouldn&#039;t have tested for it, thanks!&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 22:46:20 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c493</guid>
    
</item>
<item>
    <title>Derek Williams: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c492</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (Derek Williams)</author>
    <content:encoded>
    &lt;p&gt;Checked again. I did all my testing of type safety within the reset, not with the result. I ignored the value of the reset as it wasn&#039;t part of the original spec, just a side effect of the way I implemented it. Values were originally supposed to be returned by assigning values to futures, which is type safe. So it&#039;s not really applicable to what you are trying to do here.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 16:57:22 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c492</guid>
    
</item>
<item>
    <title>Derek Williams: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c491</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (Derek Williams)</author>
    <content:encoded>
    &lt;p&gt;Nevermind, checked to make sure the right type was infered and it wasn&#039;t. Not sure why it works properly in Akka. Maybe I need to test it more, perhaps it isn&#039;t doing what I think it is.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 16:41:03 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c491</guid>
    
</item>
<item>
    <title>Derek Williams: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c490</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (Derek Williams)</author>
    <content:encoded>
    &lt;p&gt;This works for me: &lt;a href=&quot;https://gist.github.com/951681&quot; target=&quot;_blank&quot;&gt;https://gist.github.com/951681&lt;/a&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 16:34:18 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c490</guid>
    
</item>
<item>
    <title>Dr. Roland Kuhn: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c489</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (Dr. Roland Kuhn)</author>
    <content:encoded>
    &lt;p&gt;Yes, you are right. It seems I was too much caught up in that flatMap scheme to see the easier alternative (and that one can be composed, too). At least it made me research and understand how the continuations plugin can be used, now I can confidently ambush any opportunity for using it &lt;img src=&quot;http://www.heisenbug.info/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Seriously, though, CPS would for example allow me to keep track of the generators used within one expression. What I also have in my real use case (though based solely on flatMap) is to calculate an estimate of the size of the value set in order to be able to adapt the number of samples taken.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 09:32:13 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c489</guid>
    
</item>
<item>
    <title>Johannes Rudolph: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c488</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (Johannes Rudolph)</author>
    <content:encoded>
    &lt;p&gt;The thing is: A generator like you have created here with CPS is much easier created without any CPS at all:&lt;/p&gt;

&lt;p&gt;https://gist.github.com/951254&lt;/p&gt;

&lt;p&gt;So the question is what the value of using CPS is here. The only line where you are using CPS is here:&lt;/p&gt;

&lt;p&gt;Generator( A(genInt&lt;a href=&quot;&quot;&gt;A&lt;/a&gt;, genBool&lt;a href=&quot;&quot;&gt;A&lt;/a&gt;) )&lt;/p&gt;

&lt;p&gt;CPS is essentially making the control flow explicit so what you could do behind the scenes here is changing the order in which genInt/genBool are called to produce an A, but why would you want to make use of that here?&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 09:21:08 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c488</guid>
    
</item>
<item>
    <title>rk: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c487</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (rk)</author>
    <content:encoded>
    &lt;p&gt;I tried, but simply changing it to Generator[Any] did not work and I didn&#039;t invest much time in it. What was the exact problem with @suspendable? Making the cps-annotations simpler looks desirable &lt;img src=&quot;http://www.heisenbug.info/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; Anyway, will try out more tonight.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 09:16:46 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c487</guid>
    
</item>
<item>
    <title>rk: Monadic Test Data Generator</title>
    <link>http://www.heisenbug.info/archives/8-Monadic-Test-Data-Generator.html#c486</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/8-Monadic-Test-Data-Generator.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=8</wfw:comment>

    

    <author>nospam@example.com (rk)</author>
    <content:encoded>
    &lt;p&gt;In the end my code leads to the execution of the same commands, this is true, and I started out exactly in the same way as you propose. But then I wanted to combine generators for A&#039;s and B&#039;s and some primitive types into a generator for C&#039;s, which suddenly produced more visual clutter than I liked, so I started thinking and remembered that composition is the one thing monads should be good at, so I tried it.&lt;/p&gt;

&lt;p&gt;In my specific use case this approach actually did save some typing and the result looks less confusing.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 09:09:25 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/8-guid.html#c486</guid>
    
</item>
<item>
    <title>Derek Williams: Delimited Continuations vs. For-Comprehensions</title>
    <link>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#c485</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/9-Delimited-Continuations-vs.-For-Comprehensions.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=9</wfw:comment>

    

    <author>nospam@example.com (Derek Williams)</author>
    <content:encoded>
    &lt;p&gt;I&#039;m actually not convinced that I do give up type safety with the way I did it. The &#039;reset&#039; method I have returns the correct type, not a Future[Any]. My first implementation used the &#039;@suspendable&#039; annotation which is the same as @cps[Unit], and I wasn&#039;t returning &#039;Unit&#039;. I only had to change it to get exceptions returned properly.&lt;/p&gt;

&lt;p&gt;That being said, making an implementation for a Future is different then something like this so it may not work the same. It might be worth trying it with Generator[Any] and seeing if it does break type safety. You might have to make Generator covariant for that to work.&lt;/p&gt;

&lt;p&gt;Good information in there though, I&#039;ll have to play around with your code when I get a chance.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 05:56:52 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/9-guid.html#c485</guid>
    
</item>
<item>
    <title>Cyril: Monadic Test Data Generator</title>
    <link>http://www.heisenbug.info/archives/8-Monadic-Test-Data-Generator.html#c484</link>
            <category></category>
    
    <comments>http://www.heisenbug.info/archives/8-Monadic-Test-Data-Generator.html#comments</comments>
    <wfw:comment>http://www.heisenbug.info/wfwcomment.php?cid=8</wfw:comment>

    

    <author>nospam@example.com (Cyril)</author>
    <content:encoded>
    &lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Thanks for the nice article!&lt;/p&gt;

&lt;p&gt;I am new to functional programming and I have the following question: 
why the monadic approach should be preferred to:
val someAs = 0 to 10 map ( x =&gt; A(Random.nextBoolean, Random.nextInt, Random.nextLong) )
?
This one is much simpler to code/understand/maintain.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 02 May 2011 00:15:19 +0200</pubDate>
    <guid isPermaLink="false">http://www.heisenbug.info/archives/8-guid.html#c484</guid>
    
</item>

</channel>
</rss>