Skip to content

Instantly share code, notes, and snippets.

@russ
Created February 3, 2009 18:54
Show Gist options
  • Save russ/57668 to your computer and use it in GitHub Desktop.
Save russ/57668 to your computer and use it in GitHub Desktop.
module Deck
( make
, shuffle
) where
import System.Random
data Suit = Club | Diamond | Heart | Spade
deriving (Eq, Show, Read, Enum)
data Face = One | Two | Three | Four | Five | Six | Seven | Eight | Nine
| Ten | Jack | Queen | King | Ace
deriving (Eq, Ord, Show, Read, Bounded, Enum)
make = [ (face,suit) | suit <- [ Club .. ], face <- [ One .. ] ]
shuffle (x:xs) = do
r <- randomIO :: IO [Int]
(r, x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment