game-probability-1.1: Simple probability library for dice rolls, card games and similar

Numeric.Probability.Game.PlayingCards

Description

A module containing some simple data definitions for a deck of playing cards.

Synopsis

Documentation

data PlayingCard Source

A playing card with a rank and suit. The ordering on them is arbitrary (by rank then by suit).

Constructors

PlayingCard 

Fields

rank :: Rank
 
suit :: Suit
 

data Suit Source

The standard four suits of playing cards. The ordering on them is arbitrary (alphabetical, in fact).

Constructors

Clubs 
Diamonds 
Hearts 
Spades 

Instances

data Rank Source

The rank of playing cards. The ranking is specified ace-high, as this is how many games operate. If you wish to have an ace-low ordering you can use the AceLowRank newtype.

Constructors

Two 
Three 
Four 
Five 
Six 
Seven 
Eight 
Nine 
Ten 
Jack 
Queen 
King 
Ace 

newtype AceLowRank Source

A wrapper for Rank where the Ord, Enum and Bounded instances are adjusted to list Ace as the lowest item rather than the highest.

Constructors

AceLow 

Fields

alRank :: Rank
 

deck :: Cards PlayingCardSource

The standard full deck of 52 playing cards.

sameSuit :: PlayingCard -> PlayingCard -> BoolSource

Checks if the two cards have the same suit.

sameRank :: PlayingCard -> PlayingCard -> BoolSource

Checks if the two cards have the same rank.