-- }}}

-- Fifteens {{{

-- TODO: count fifteens

-- }}}

rankGroups :: [Card] -> [(Rank,Int)]
rankGroups cs = M.toList $ foldr f M.empty cs
  where
  f (Card r _) = flip M.alter r $ \mi -> case mi of
    Just i -> Just (i + 1)
    Nothing -> Just 1
rankGroups :: [Card] -> [(Rank,Int)]
rankGroups cs = M.toList $ foldr f M.empty cs
  where
  f (Card r _) = flip M.alter r $ \mi -> case mi of
    Just i -> Just (i + 1)
    Nothing -> Just 1
rankGroups cs = M.toList $ foldr f M.empty cs
  where
  f (Card r _) = flip M.alter r $ \mi -> case mi of
    Just i -> Just (i + 1)
    Nothing -> Just 1