3 ms·
This seems closely related to this classic Functional Pearl: https://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf https://web.engr.oregonstate.edu/~erwi
by black_knight 1y ago
This seems closely related to this classic Functional Pearl: https://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf https://web.engr.oregonstate.edu/~erwig/papers/PFP_JFP06.pdf
It’s so cool!
I always start my introductory course on Haskell with a demo of the Monty Hall problem with the probability monad and using rationals to get the exact probability of winning using the two strategies as a fraction.
- internet_points 1y agoSee also the Haskell library monad-bayes https://monad-bayes.netlify.app/tutorials/ https://monad-bayes.netlify.app/tutorials/ https://www.tweag.io/blog/2019-09-20-monad-bayes-1/ https://www.tweag.io/blog/2019-09-20-monad-bayes-1/