module Main where import IO main = do hSetBuffering stdin LineBuffering putStrLn "Enter a number (or 0 to end):" nums <- getData putStrLn ("The sum of all numbers is: " ++ (foldl (+) [0] (nums))) getData = do line <- getLine if line == "0" then return [] else do rest <- getData return ((read line) : (read rest))