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

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