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.
-BenRI
Hi, My program BAli-Phy implements probabilistic programming with models written as Haskell programs. http://www.bali-phy.org/models.phpDear 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