probability-0.1: Computations with discrete random variables

Collection

Contents

Synopsis

Documentation

type Collection a = [a]Source

select2 :: Eq a => Collection a -> Dist (a, a)Source

selectMany :: Eq a => Int -> Collection a -> Dist ([a], Collection a)Source

select :: Eq a => Int -> Collection a -> Dist [a]Source

Example collections

marbles

data Marble Source

Constructors

R 
G 
B 

Instances

cards

data Suit Source

Constructors

Club 
Spade 
Heart 
Diamond 

Instances

data Rank Source

Constructors

Plain Int 
Jack 
Queen 
King 
Ace 

Instances

type Card = (Rank, Suit)Source

Example

value :: Card -> IntSource

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.

win :: ([Card], b) -> BoolSource