-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.hs
52 lines (47 loc) · 1.86 KB
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
module Main where
import System.Environment
import System.Exit
import Data.String.Interpolate
import Control.Monad
import qualified Year2015.Day1.Solution
import qualified Year2015.Day2.Solution
import qualified Year2015.Day3.Solution
import qualified Year2015.Day4.Solution
import qualified Year2015.Day5.Solution
import qualified Year2015.Day6.Solution
import qualified Year2015.Day7.Solution
import qualified Year2015.Day8.Solution
import qualified Year2015.Day9.Solution
import qualified Year2015.Day10.Solution
import qualified Year2015.Day11.Solution
import qualified Year2015.Day12.Solution
import qualified Year2020.Day5.Solution
import qualified Year2021.Day5.Solution
main :: IO ()
main = do
args <- getArgs
when (length args /= 2) (die "Not enough arguments")
let [year, day] = args
inputFile = [i|Year#{year}/Day#{day}/input|]
input = readFile inputFile
case year of
"2015" -> case day of
"1" -> input >>= Year2015.Day1.Solution.solve
"2" -> input >>= Year2015.Day2.Solution.solve
"3" -> input >>= Year2015.Day3.Solution.solve
"4" -> input >>= Year2015.Day4.Solution.solve
"5" -> input >>= Year2015.Day5.Solution.solve
"6" -> input >>= Year2015.Day6.Solution.solve
"7" -> input >>= Year2015.Day7.Solution.solve
"8" -> input >>= Year2015.Day8.Solution.solve
"9" -> input >>= Year2015.Day9.Solution.solve
"10" -> input >>= Year2015.Day10.Solution.solve
"11" -> input >>= Year2015.Day11.Solution.solve
"12" -> Year2015.Day12.Solution.solve inputFile
_ -> putStrLn [i|Day #{day} not solved in year #{year}|]
"2020" -> case day of
"5" -> input >>= Year2020.Day5.Solution.solve
_ -> putStrLn [i|Day #{day} not solved in year #{year}|]
"2021" -> case day of
"5" -> input >>= Year2021.Day5.Solution.solve
_ -> putStrLn [i|No solutions for year #{year}|]