import Control.Monad(foldM) import System.Environment(getArgs) -- readFile :: FilePath -> IO String -- getArgs :: IO [String] -- foldM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a -- see http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Monad.html#v%3AfoldM freadAppend :: String -> FilePath -> IO String freadAppend x f = do str <- readFile f return $ x++str main :: IO () main = do files <- getArgs str <- foldM freadAppend "" files putStrLn str