Skip to content

Instantly share code, notes, and snippets.

@metanest
Created November 30, 2016 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metanest/69ca365bcc456179ee9f35a6600fab67 to your computer and use it in GitHub Desktop.
Save metanest/69ca365bcc456179ee9f35a6600fab67 to your computer and use it in GitHub Desktop.
-- FizzBuzz
main :: IO ()
main = mapM_ putStrLn $ map f [1..]
where
f x = g x
where
g :: Integer -> String
g | x`mod`15 == 0 = (\_ -> "FizzBuzz")
| x`mod` 5 == 0 = (\_ -> "Buzz")
| x`mod` 3 == 0 = (\_ -> "Fizz")
| otherwise = show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment