<div class="gmail_quote">2009/7/7 Matthias Görgens <span dir="ltr">&lt;<a href="mailto:matthias.goergens@googlemail.com">matthias.goergens@googlemail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">&gt;&gt; What I wondered was, if one could hid the random plumbing in some data<br>
&gt;&gt; structure, like the state monad, but less linear.<br>
&gt;<br>
&gt; This problem cries for a State monad solution - but you don&#39;t need to<br>
&gt; do it yourself, there&#39;s already a Random monad defined for you.<br>
<br>
</div>Yes, but I only need the random values inside splitOnMedia.  The rest<br>
is just non-linear plumbing.  We do not know beforehand how many<br>
random values a branch quicksort will consume --- neither do we ware<br>
about the state of the random generator at the end.  Do you consider<br>
the RandomMonad the best fit?</blockquote><div><br></div><div>Random monad is a very natural choice for &quot;random cloud&quot; computations.  Don&#39;t think of it as a state monad -- that&#39;s an implementation detail.  You can think of a value of type Random a as a &quot;probability distribution of a&#39;s&quot;; and there are natural definitions for the monad operators on this semantics.</div>
<div><br></div><div>I blogged about this a while ago:  <a href="http://lukepalmer.wordpress.com/2009/01/17/use-monadrandom/">http://lukepalmer.wordpress.com/2009/01/17/use-monadrandom/</a></div><div><br></div><div>Luke</div>
</div>