fzzbzz :: Int -> String -> (String, Int) -> (String, Int)
fzzbzz m sound (str, x) = (str ++ if mod x m == 0 then sound else "", x)
fix :: (String, Int) -> String
fix ("", x) = show x
fix (st, _) = st
fizzbuzz :: [(String, Int)] -> Int -> String
fizzbuzz sounds top
| top <= 0 = ""
| otherwise = foldr (\x y -> x ++ "\n" ++ y) [] (map fizzer numbers)
where fizzer = (foldl (.) fix (reverse [fzzbzz i s | (s, i) <- sounds]))
numbers = take top (zip (cycle [""]) [1..])
main = putStr (fizzbuzz [("Fizz", 3), ("Buzz", 5)] 100)