Skip to content

Instantly share code, notes, and snippets.

@stuhacking
Created January 22, 2014 13:43
Show Gist options
  • Save stuhacking/8558931 to your computer and use it in GitHub Desktop.
Save stuhacking/8558931 to your computer and use it in GitHub Desktop.
module Main where
-- Infinite fizzbuzz sequence.
fizzbuzz :: [String]
fizzbuzz = [convert x | x <- [1..]]
where
convert s
| s `mod` 15 == 0 = "FizzBuzz"
| s `mod` 5 == 0 = "Buzz"
| s `mod` 3 == 0 = "Fizz"
| otherwise = show s
main :: IO ()
main = do
mapM_ putStrLn $ take 100 fizzbuzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment