Created
January 25, 2020 03:41
-
-
Save lgastako/2e7dfd6b1118bb408ff114a4be46eac9 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
main :: IO () | |
main = mapM_ putStrLn beerLines | |
where | |
beerLines = concatMap genLines [99, 98..1] | |
genLines n = | |
[ firstLine n | |
, "Take one down, pass it around, " ++ suffix n | |
] | |
firstLine 1 = "1 bottle of beer on the wall, 1 bottle of beer." | |
firstLine n = show n ++ " bottles of beer on the wall, " | |
++ show n ++ " bottles of beer." | |
suffix 1 = "no more beer on the wall!" | |
suffix 2 = "1 bottle of beer on the wall" | |
suffix n = show (n - 1) ++ " bottles of beer on the wall" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment