-- CPSC 312 - 2024 - Interactive accumulator
-- Copyright D. Poole 2024 released under the GPL.


module IOAdder where

-- To run it, try:
-- ghci
-- :load IOAdder
-- go

accum n =
   do
       putStr ("Total " ++ show n ++ "\nInput an integer (exit with empty line): ")
       line <- getLine
       if (line=="")
       then
           return n
       else
           accum (n+read line)

go = accum 0
