-- Write each integer in the input out on a line

module Main where

{-
   This is the same program as main3.hs.  But we illustrate 'import'.  We
   import a version of function composition that allows us to to compose
   functions left to right (which reads better) instead of right-to-left.
-}
import Control.Arrow ((>>>))

{-
   (>>>)    :: Control.Category.Category cat => cat a b -> cat b c -> cat a c
   words    :: String->[String]      ; breaks a string into words at whitespace
   unlines  :: [String] -> String    ; puts a newline on every string
   interact :: (String -> String) -> IO ()
   map      :: a->b -> [a] ->[b]     ; apply function to every item in sequence
 -}

main :: IO()
main = interact (words >>> map (show . readInt) >>> unlines)

-- 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 main4.hs"
--  End: