A module containing some simple data definitions for a deck of playing cards.
- data PlayingCard = PlayingCard {}
- data Suit
- data Rank
- newtype AceLowRank = AceLow {}
- deck :: Cards PlayingCard
- sameSuit :: PlayingCard -> PlayingCard -> Bool
- sameRank :: PlayingCard -> PlayingCard -> Bool
Documentation
data PlayingCard Source
A playing card with a rank and suit. The ordering on them is arbitrary (by rank then by suit).
The standard four suits of playing cards. The ordering on them is arbitrary (alphabetical, in fact).
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.
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.
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.