[Haskell-cafe] Lazy Probabilistic Programming System in Haskell

Benjamin Redelings benjamin.redelings at gmail.com
Fri Jul 16 23:35:56 UTC 2021

Hi Olaf,

Are you asking if

	run $ (const y) <$> normal 0 1

has the same cost as

	run $ return y

for some interpreter `run`?

Yes, the cost is the same.  In do-notation, we would have

	run $ do
		x <- normal 0 1
		return $ (const y x)

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.


On 7/16/21 8:27 AM, Olaf Klinke wrote:
>> Hi,
>> My program BAli-Phy implements probabilistic programming with models
>> written as Haskell programs.
>> http://www.bali-phy.org/models.php
> 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]
> https://mail.haskell.org/pipermail/haskell-cafe/2020-November/132905.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210716/96258ccb/attachment.html>

More information about the Haskell-Cafe mailing list