Files
aoc-2022/app/Main.hs

32 lines
644 B
Haskell
Raw Normal View History

2023-08-27 22:30:00 +02:00
{-# LANGUAGE LambdaCase #-}
module Main where
import Lib
2023-08-28 18:40:38 +02:00
2023-08-27 22:30:00 +02:00
import System.Environment (getArgs)
2023-08-30 09:32:12 +02:00
paths :: [FilePath]
paths =
[ "./data/01.in"
, "./data/02.in"
, "./data/03.in"
2023-08-28 18:40:38 +02:00
]
2023-08-30 09:32:12 +02:00
solutions :: [(Int, Day, FilePath)]
solutions = zip3 [1 ..] (map head days) paths
2023-08-28 18:40:38 +02:00
runAll :: [(Int, Day, FilePath)] -> IO ()
runAll = mapM_ (\(dayNum, day, path) -> run day path >>= printDR dayNum)
2023-08-27 22:30:00 +02:00
header :: IO ()
header = putStrLn "[ Day ]------(1)-----+------(2)----"
usage :: IO ()
usage = putStrLn "./Main"
main :: IO ()
main =
getArgs >>= \case
2023-08-28 18:40:38 +02:00
["all"] -> header >> runAll solutions
2023-08-29 09:24:31 +02:00
_ -> header >> runAll [last solutions]