Created
December 17, 2013 14:51
-
-
Save tanakh/8006086 to your computer and use it in GitHub Desktop.
fizzbuzz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fizzbuzz :: Int -> String | |
fizzbuzz n = fromMaybe (show n) $ | |
(guard (n `mod` 3 == 0) >> pure "Fizz") <> | |
(guard (n `mod` 5 == 0) >> pure "Buzz") | |
main :: IO () | |
main = forM_ [1..100] $ putStrLn . fizzbuzz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment