probability-0.2.7: Probabilistic Functional Programming

Safe HaskellSafe
LanguageHaskell98

Numeric.Probability.Example.MontyHall

Contents

Synopsis

Documentation

data Door Source #

Constructors

A 
B 
C 
Instances
Eq Door Source # 
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

(==) :: Door -> Door -> Bool #

(/=) :: Door -> Door -> Bool #

Ord Door Source # 
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

compare :: Door -> Door -> Ordering #

(<) :: Door -> Door -> Bool #

(<=) :: Door -> Door -> Bool #

(>) :: Door -> Door -> Bool #

(>=) :: Door -> Door -> Bool #

max :: Door -> Door -> Door #

min :: Door -> Door -> Door #

Show Door Source # 
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

showsPrec :: Int -> Door -> ShowS #

show :: Door -> String #

showList :: [Door] -> ShowS #

data State Source #

Constructors

Doors 

Fields

Instances
Eq State Source # 
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

(==) :: State -> State -> Bool #

(/=) :: State -> State -> Bool #

Ord State Source # 
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

compare :: State -> State -> Ordering #

(<) :: State -> State -> Bool #

(<=) :: State -> State -> Bool #

(>) :: State -> State -> Bool #

(>=) :: State -> State -> Bool #

max :: State -> State -> State #

min :: State -> State -> State #

Show State Source # 
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

start :: State Source #

initial configuration of the game status

hide :: Trans State Source #

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

Alternative modeling

Play the game the monadic way