diff options
Diffstat (limited to '2019/Input.hs')
-rw-r--r-- | 2019/Input.hs | 20 |
1 files changed, 20 insertions, 0 deletions
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) |