You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
586 B

module Main where
import qualified Day1 as D1
import qualified Day2 as D2
import qualified Day3 as D3
solutions :: [(String -> String, String -> String)]
solutions = [ (D1.part1, D1.part2)
, (D2.part1, D2.part2)
, (D3.part1, D3.part2)
]
run :: Int -> Int -> IO ()
run day part = do
input <- readFile ("inputs/" ++ show day)
let select = if part == 1 then fst else snd
putStrLn $ select (solutions !! (day - 1)) input
pure ()
main :: IO ()
main = do
day <- getLine
problem <- getLine
run (read day :: Int) (read problem :: Int)