Skip to content

Instantly share code, notes, and snippets.

@jdiez17
Last active August 29, 2015 14:07
Show Gist options
  • Save jdiez17/3a697ca4cafd06bf4949 to your computer and use it in GitHub Desktop.
Save jdiez17/3a697ca4cafd06bf4949 to your computer and use it in GitHub Desktop.
module Fizzbuzz where
import Data.List (unlines)
fizzbuzz :: Int -> String
fizzbuzz n = case (n `mod` 3, n `mod` 5) of
(0, 0) -> "FizzBuzz"
(0, _) -> "Fizz"
(_, 0) -> "Buzz"
(_, _) -> show n
showFizzbuzz :: Int -> IO ()
showFizzbuzz n = do
let seq = [fizzbuzz i | i <- [1..n]]
putStrLn $ unlines seq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment