2022-12-01 08:57:41 -05:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2022-12-01 08:29:30 -05:00
|
|
|
module Main (main) where
|
2022-12-01 08:57:41 -05:00
|
|
|
|
2022-12-01 09:26:39 -05:00
|
|
|
import System.Environment (getArgs)
|
2022-12-01 10:07:52 -05:00
|
|
|
import qualified Aoc.Day1
|
2022-12-02 07:42:52 -05:00
|
|
|
import qualified Aoc.Day2
|
2022-12-01 08:57:41 -05:00
|
|
|
|
2022-12-01 08:29:30 -05:00
|
|
|
main :: IO ()
|
|
|
|
main = do
|
2022-12-01 10:07:52 -05:00
|
|
|
(dayS:partS:_) <- getArgs
|
|
|
|
let day = read dayS :: Integer
|
|
|
|
let part = read partS :: Integer
|
|
|
|
|
|
|
|
contents <- readFile ("input/" ++ (show day) ++ ".txt")
|
2022-12-01 08:29:30 -05:00
|
|
|
|
2022-12-01 10:07:52 -05:00
|
|
|
let f = case day of 1 -> Aoc.Day1.solve
|
2022-12-02 07:42:52 -05:00
|
|
|
2 -> Aoc.Day2.solve
|
2022-12-01 10:07:52 -05:00
|
|
|
_ -> error "unknown day"
|
2022-12-01 09:26:39 -05:00
|
|
|
|
2022-12-01 10:07:52 -05:00
|
|
|
putStrLn $ show $ f part contents
|
2022-12-01 08:29:30 -05:00
|
|
|
|