probability-0.2.5.2: Probabilistic Functional Programming

Safe HaskellSafe
LanguageHaskell98

Numeric.Probability.Example.Collection

Contents

Synopsis

Documentation

type Collection a = [a] Source #

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

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

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

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

Example collections

marbles

data Marble Source #

Constructors

R 
G 
B 
Instances
Eq Marble Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

Methods

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

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

Ord Marble Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

Show Marble Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

cards

data Suit Source #

Constructors

Club 
Spade 
Heart 
Diamond 
Instances
Enum Suit Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

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 Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

Methods

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

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

Ord Suit Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

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 Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

Methods

showsPrec :: Int -> Suit -> ShowS #

show :: Suit -> String #

showList :: [Suit] -> ShowS #

data Rank Source #

Constructors

Plain Int 
Jack 
Queen 
King 
Ace 
Instances
Eq Rank Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

Methods

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

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

Ord Rank Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

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 Source # 
Instance details

Defined in Numeric.Probability.Example.Collection

Methods

showsPrec :: Int -> Rank -> ShowS #

show :: Rank -> String #

showList :: [Rank] -> ShowS #

type Card = (Rank, Suit) Source #

Example

value :: Card -> Int Source #

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) Source #

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

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