probability-0.2.8: Probabilistic Functional Programming
Safe HaskellSafe-Inferred
LanguageHaskell98

Numeric.Probability.Example.MontyHall

Documentation

data Door Source #

Constructors

A
B
C

Instances

Instances details
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

showsPrec :: Int -> Door -> ShowS #

show :: Door -> String #

showList :: [Door] -> ShowS #

Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

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

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

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 #

doors :: [Door] Source #

data State Source #

Constructors

Fields

Instances

Instances details
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

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

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

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 #

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

choose :: Trans State Source #

open :: Trans State Source #

type Strategy = Trans State Source #

switch :: Strategy Source #

stay :: Strategy Source #

game :: Strategy -> Trans State Source #

Playing the game

data Outcome Source #

Constructors

Win

Instances

Instances details
Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

showsPrec :: Int -> Outcome -> ShowS #

show :: Outcome -> String #

showList :: [Outcome] -> ShowS #

Instance details

Defined in Numeric.Probability.Example.MontyHall

Methods

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

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

result :: State -> Outcome Source #

eval :: Strategy -> Dist Outcome Source #

simEval :: Int -> Strategy -> RDist Outcome Source #

Alternative modeling

firstChoice :: Dist Outcome Source #

switch' :: Trans Outcome Source #

Play the game the monadic way

type StrategyM = Door -> Door -> Door Source #

stayM :: StrategyM Source #

switchM :: StrategyM Source #

evalM :: StrategyM -> Dist Outcome Source #

AltStyle によって変換されたページ (->オリジナル) /