Card datatypes and views
Use these for defining card-specifc game logic or for displaying specific cards.
A playing card type.
Can either hold a card of suit and face, or a blank card.
Face numbers are designated from 1 to 13 for A-K. Games which treat the ace differently can specify their behavior through the game logic.
The blank variant is useful for displaying cards that have not been flipped over, for instance.
aceOfSpades =
Card Spades 1
blankCard =
BackConstruct a new card.
The first argument must be one of "spades", "diamonds", "clubs", or "hearts" (any case) for the card suit.
The second argument must be an integer from 1 to 13 for A-K.
Use Cards.defaultNew if you want a Card instead of a Maybe Card.
new "spades" 1 == Just (Card Spades 1)
new "SPADES" 1 == Just (Card Spades 1)
new "horses" 1 == Nothing
new "spades" 0 == NothingConstruct a new card with a default argument.
The first input is the default card to use if construction fails.
The remaining two inputs correspond to the two inputs for Cards.new.
defaultNew Back "spades" 1 == Card Spades 1
defaultNew Back "SPADES" 1 == Card Spades 1
defaultNew Back "horses" 1 == Back
defaultNew Back "spades" 0 == Back
A playing card suit type.
Useful for pattern matching behavior of different games that are based on the suit of the card.