module Main where {- The file name should generally be the same as the module name. But these short modules are not used as a library elsewhere, so the file name does not matter. -} {- (.) :: (a->b) -> (c->a) -> c -> b ; function composition words :: String->[String] ; breaks a string into words at whitespace unlines :: [String] -> String ; puts a newline on every string interact :: (String->String) -> IO (); the input and output are strings map :: a->b -> [a] ->[b] ; apply function to every item in sequence -} main :: IO() main = interact (unlines . map (show . 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 -- ------------For GNU Emacs ------------ -- Local Variables: -- compile-command: "ghc -Wall main3.hs" -- End: