<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Olaf,</p>
<p>Are you asking if <br>
</p>
<pre> run $ (const y) <$> normal 0 1 </pre>
<p>has the same cost as <br>
</p>
<pre> run $ return y
</pre>
<p>for some interpreter `run`?</p>
<p>Yes, the cost is the same. In do-notation, we would have</p>
<pre> run $ do
x <- normal 0 1
return $ (const y x)
</pre>
<p>Since `const y` never forces `x`, no time is spent evaluating
`run $ normal 0 1`. That is basically what I mean by saying that
the language is lazy.</p>
<p>-BenRI</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 7/16/21 8:27 AM, Olaf Klinke wrote:<br>
</div>
<blockquote type="cite"
cite="mid:f972c99cdda4772c87a9c098a2836f7d85dc719e.camel@aatal-apotheke.de">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Hi,
My program BAli-Phy implements probabilistic programming with models
written as Haskell programs.
<a class="moz-txt-link-freetext" href="http://www.bali-phy.org/models.php">http://www.bali-phy.org/models.php</a>
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Dear Benjamin,
last time you announced BAli-Phy I pestered you with questions about
semantics. In the meantime there was a discussion [1] on this list
regarding desirable properties of probabilistic languages and monads in
general. A desirable property of any probabilistic language is that
when you define a distribution but map a constant function over it,
then this has the same computational cost as returning the constant
directly. Can you say anything about that?
Cheers,
Olaf
[1]
<a class="moz-txt-link-freetext" href="https://mail.haskell.org/pipermail/haskell-cafe/2020-November/132905.html">https://mail.haskell.org/pipermail/haskell-cafe/2020-November/132905.html</a>
</pre>
</blockquote>
</body>
</html>