-- sort a poker hand (incomplete)
-- Disclaimer:  I started learning Haskell less than two days ago

import List

data Suit = Spades | Hearts | Diamonds | Clubs deriving (Eq, Ord, Show)
type Value = Int

pokerSort :: [(Value, Suit)] -> String
pokerSort cards
        | length (nub suits) == 1 = "Flush"
        | otherwise               = "High card"
        where
                sorted    = sort cards
                hicard    = last sorted
                values    = sort (map fst sorted)
                suits     = map snd sorted

main = do
        putStrLn ("High card: " ++ (pokerSort [(1,Spades), (5,Spades), (4,Spades), (8,Spades), (10,Clubs)]))
        putStrLn ("Flush    : " ++ (pokerSort [(1,Spades), (5,Spades), (4,Spades), (8,Spades), (10,Spades)]))