fork download
  1. fizzbuzz n = [ fb | x <- [ 1 .. n ], fb <- [ f ++ b | f <- [ if x `mod` 3 == 0 then "fizz" else "" ], b <- [ if x `mod` 5 == 0 then "buzz" else "" ], f <- [ if (f == "") && (b == "") then show x else f ] ] ]
  2.  
  3. putHeadLn xs
  4. | (length xs) > 0 = do { putStrLn $ head xs ; putHeadLn $ tail xs }
  5. | otherwise = do return ()
  6.  
  7. main = do putHeadLn $ fizzbuzz 20
Success #stdin #stdout 0s 6276KB
stdin
Standard input is empty
stdout
1
2
fizz
4
buzz
fizz
7
8
fizz
buzz
11
fizz
13
14
fizzbuzz
16
17
fizz
19
buzz