1
0
Fork 0
advent-of-code/2022/app/Main.hs

26 lines
635 B
Haskell
Raw Normal View History

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-04 08:33:19 -05:00
import qualified Aoc.Day3
2022-12-04 09:33:47 -05:00
import qualified Aoc.Day4
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-04 08:33:19 -05:00
3 -> Aoc.Day3.solve
2022-12-04 09:33:47 -05:00
4 -> Aoc.Day4.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