Created
July 30, 2013 18:20
-
-
Save tamasd/6115421 to your computer and use it in GitHub Desktop.
This file contains 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
import Prelude | |
fizzbuzz :: (Eq a, Num a) => a -> a -> [Char] -> [Char] | |
fizzbuzz 0 0 _ = "FizzBuzz" | |
fizzbuzz 0 _ _ = "Fizz" | |
fizzbuzz _ 0 _ = "Buzz" | |
fizzbuzz _ _ x = x | |
checkfb :: (Show a, Integral a) => a -> [Char] | |
checkfb n = fizzbuzz (n `rem` 3) (n `rem` 5) (show n) | |
main :: IO () | |
main = mapM_ putStrLn $ map checkfb [1..100] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment