probability-0.2.2.1: Probabilistic Functional Programming

Numeric.Probability.Example.MontyHall

Contents

Synopsis

Documentation

data Door

Constructors

A 
B 
C 

Instances

doors :: [Door]

data State

Constructors

Doors 

Fields

prize :: Door
 
chosen :: Door
 
opened :: Door
 

Instances

start :: State

initial configuration of the game status

hide :: Trans State

Steps of the game:

  1. hide the prize
  2. choose a door
  3. open a non-open door, not revealing the prize
  4. apply strategy: switch or stay

Playing the game

data Outcome

Constructors

Win 
Lose 

Alternative modeling

Play the game the monadic way

type StrategyM = Door -> Door -> Door