Skip to content

Instantly share code, notes, and snippets.

@s-e
Created January 1, 2014 06:27
Show Gist options
  • Save s-e/8205641 to your computer and use it in GitHub Desktop.
Save s-e/8205641 to your computer and use it in GitHub Desktop.
fizzbuzz.hs
fizzBuzzer :: (Integral a, Show a) => a -> [Char]
fizzBuzzer x
| ((x `mod` 3 == 0) && (x `mod` 5 == 0)) = "FizzBuzz"
| (x `mod` 3 == 0) = "Fizz"
| (x `mod` 5 == 0) = "Buzz"
| otherwise = show x
main :: IO ()
main = mapM_ putStrLn [ fizzBuzzer x | x <- [1..100]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment