-- Sum the integers in the standard input stream

module Main where

main :: IO()
main = interact (addln . show . sum . (map readInt) . words)

-- Specialize 'read' from the Haskell prologue for integers.
-- Without the type information read won't know what type is desired.
readInt :: String -> Int
readInt = read

-- (++) :: [a] -> [a] -> [a]"  sequence (list) concatentation

addln :: String -> String
addln s = s ++ "\n"  -- (++ "\n")

--   ------------For GNU Emacs ------------
--  Local Variables:
--  compile-command: "ghc -Wall sum.hs"
--  End: