https://github.com/chris-taylor/hs-probability
The code that solves this problem is:
solve = do coin <- choose (999/1000) fair biased tosses <- replicateM 10 coin condition (tosses == replicate 10 Head) nextToss <- coin return nextToss where fair = choose (1/2) Head Tail biased = certainly Head
https://github.com/chris-taylor/hs-probability
The code that solves this problem is: