module Bottles where import Data.List -- First part of the verse antecedent 1 = "1 bottle of beer on the wall. 1 botle of beer. \n" antecedent 0 = "No more bottles of beer on the wall, no more bottles of beer.\n" antecedent n = (show n) ++ " bottles of beer on the wall. " ++ (show n) ++ " bottles of beer.\n" -- Second part of the verse consequent 0 = "Go to the store and buy some more, 99 bottles of beer on the wall...\n" consequent n = "Take one down, pass it around. " ++ (show (n - 1)) ++ " bottles of beer on the wall!\n" -- Join antecedent and consequent makeLine n = (antecedent n) ++ (consequent n) e = cycle [99, 98..0] -- Combine index with lyrics f = map (\x -> makeLine x) -- How many verses we want to sing n = 120 all = take n e main = do putStrLn $ intercalate "" $ f Bottles.all