Many probability and statistic problems are posed using playing cards. In this recipe, we will create a data structure and useful functions for the cards.
There are a total of 52 playing cards in a standard deck. Each card has one of the following four suits:
Spades
Hearts
Diamonds
Clubs
Also, each card has one out of 13 ranks as follows:
Integers between 2 and 10 inclusive
Jack
Queen
King
Ace
Install the probability
library using cabal as follows:
$ cabal install probability
Review the sample code on the probability
package about collections at http://hackage.haskell.org/package/probability-0.2.4/docs/src/Numeric-Probability-Example-Collection.html.
The recipe is based heavily on the probability example given in the link.