probability-0.2.5.1: Probabilistic Functional Programming

Safe HaskellSafe
LanguageHaskell98

Numeric.Probability.Example.Collection

Contents

Synopsis

Documentation

type Collection a = [a] #

selectOne :: Fractional prob => StateT (Collection a) (T prob) a #

select1 :: Fractional prob => Collection a -> T prob a #

select2 :: Fractional prob => Collection a -> T prob (a, a) #

select :: Fractional prob => Int -> Collection a -> T prob [a] #

Example collections

marbles

data Marble #

Constructors

R 
G 
B 

Instances

cards

data Suit #

Constructors

Club 
Spade 
Heart 
Diamond 

Instances

Enum Suit # 

Methods

succ :: Suit -> Suit #

pred :: Suit -> Suit #

toEnum :: Int -> Suit #

fromEnum :: Suit -> Int #

enumFrom :: Suit -> [Suit] #

enumFromThen :: Suit -> Suit -> [Suit] #

enumFromTo :: Suit -> Suit -> [Suit] #

enumFromThenTo :: Suit -> Suit -> Suit -> [Suit] #

Eq Suit # 

Methods

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

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

Ord Suit # 

Methods

compare :: Suit -> Suit -> Ordering #

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

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

(>) :: Suit -> Suit -> Bool #

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

max :: Suit -> Suit -> Suit #

min :: Suit -> Suit -> Suit #

Show Suit # 

Methods

showsPrec :: Int -> Suit -> ShowS #

show :: Suit -> String #

showList :: [Suit] -> ShowS #

data Rank #

Constructors

Plain Int 
Jack 
Queen 
King 
Ace 

Instances

Eq Rank # 

Methods

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

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

Ord Rank # 

Methods

compare :: Rank -> Rank -> Ordering #

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

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

(>) :: Rank -> Rank -> Bool #

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

max :: Rank -> Rank -> Rank #

min :: Rank -> Rank -> Rank #

Show Rank # 

Methods

showsPrec :: Int -> Rank -> ShowS #

show :: Rank -> String #

showList :: [Rank] -> ShowS #

type Card = (Rank, Suit) #

faces :: [Rank] #

ranks :: [Rank] #

suits :: [Suit] #

Example

value :: Card -> Int #

mini-blackjack: draw 2 cards, and if value is less than 14, continue drawing until value equals or exceeds 14. if values exceeds 21, you lose, otherwise you win.

draw :: Fractional prob => ([Card], Collection Card) -> T prob ([Card], Collection Card) #

win :: ([Card], b) -> Bool #

chanceWin :: (Fractional prob, Ord prob, Random prob) => T (T prob Bool) #