From 35f82a2aed37c8daf523ac4c9fbf7112659e8dda Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sun, 1 Dec 2019 09:42:09 +0100 Subject: Start 2019! --- 2019/Input.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 2019/Input.hs (limited to '2019/Input.hs') diff --git a/2019/Input.hs b/2019/Input.hs new file mode 100644 index 0000000..afce44e --- /dev/null +++ b/2019/Input.hs @@ -0,0 +1,20 @@ +module Input where + +import System.Environment +import System.IO + + +getInput :: Int -> IO [String] +getInput day = do + let fname = show day ++ ".in" + + args <- getArgs + str <- case args of + ["-"] -> getContents + [] -> readFile fname + _ -> do + hPutStrLn stderr $ "WARNING: Unrecognised command-line parameters " ++ show args ++ + ", reading from " ++ fname + readFile fname + + return (lines str) -- cgit v1.2.3-70-g09d2