How can non-determinism be modeled with a List monad?
Can anyone explain (better with an example in plain English) what a list monad can do to model non-deterministic calculations? Namely what the problem is and what solution a list monad can offer. Here's an example based on coin tossing. The problem is as follows: You have two coins, labeled Biased and Fair . The Biased coin has two heads, and the Fair coin has one head and one tail. Pick one of these coins at random, toss it and observe the result. If the result is a head, what is the probability that you picked the Biased coin? We can model this in Haskell as follows. First, you need the