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.

23 lines
509 B

3 weeks ago
  1. module Main where
  2. import qualified Day1 as D1
  3. import qualified Day2 as D2
  4. solutions :: [(String -> String, String -> String)]
  5. solutions = [(D1.part1, D1.part2),
  6. (D2.part1, D2.part2)]
  7. run :: Int -> Int -> IO ()
  8. run day part = do
  9. input <- readFile ("inputs/" ++ show day)
  10. let select = if part == 1 then fst else snd
  11. putStrLn $ select (solutions !! (day - 1)) input
  12. pure ()
  13. main :: IO ()
  14. main = do
  15. day <- getLine
  16. problem <- getLine
  17. run (read day :: Int) (read problem :: Int)