Skip to content

Instantly share code, notes, and snippets.

@patrickt
Created May 1, 2014 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickt/ba2c184106656b2c1ff3 to your computer and use it in GitHub Desktop.
Save patrickt/ba2c184106656b2c1ff3 to your computer and use it in GitHub Desktop.
import Data.ByteString (ByteString)
import System.Environment
import System.IO (openFile, IOMode (..))
import System.IO.Streams (InputStream, concatInputStreams, connectTo)
import System.IO.Streams.Handle (handleToInputStream, stdout)
argf :: IO (InputStream ByteString)
argf = do
args <- fmap tail getArgs
handles <- mapM (flip openFile ReadMode) args
streams <- mapM handleToInputStream handles
concatInputStreams streams
main :: IO ()
main = argf >>= connectTo stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment