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

30 lines
764 B
Haskell
Raw Permalink 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-05 07:58:28 -05:00
import qualified Aoc.Day5
2022-12-08 23:06:29 -05:00
import qualified Aoc.Day6
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-05 07:58:28 -05:00
5 -> Aoc.Day5.solve
2022-12-08 23:06:29 -05:00
6 -> Aoc.Day6.solve
2022-12-01 10:07:52 -05:00
_ -> error "unknown day"
2022-12-01 09:26:39 -05:00
putStrLn $ f part contents
2022-12-01 08:29:30 -05:00