PFP: A Probabilistic Functional Programming Library for Haskell (2006)
A Probabilistic Functional Programming Library for Haskell Version: June 2006 Distributions can represent events, such as the roll of a die or the flip of a coin. For example, or example, the outcome of a die roll can be expressed as follows. die :: Dist Int die = uniform [1..6] die > die 1 16.7% 2 16.7% 3 16.7% 4 16.7% 5 16.7% 6 16.7% uniform uniform succOrId x = uniform [x, x+1] choose succOrId x = choose 0.5 x (x+1) droll = die >>= succOrId droll = do d <- die succOrId d To use t