feat: allow solution ID to be passed as CLI arg

This commit is contained in:
Kiana Sheibani 2024-12-05 09:15:49 -05:00
parent 94448ca2f5
commit b40650cd6b
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -3,6 +3,7 @@ module Main
import Data.SortedMap
import Data.Problem
import Language.Reflection
import System
import AllDays
@ -30,11 +31,13 @@ getInput = go ""
main : IO ()
main = do
putStr "Solution: "
Just pr <- parseProblem <$> getLine
| Nothing => putStrLn "Invalid solution ID"
let Just func = lookup pr solMap
| Nothing => putStrLn "This part is not implemented yet!"
sol <- case !getArgs of
[_, s] => pure s
_ => putStr "Solution: " >> getLine
let Just pr = parseProblem sol
| Nothing => putStrLn "ERROR: Invalid solution"
Just func = lookup pr solMap
| Nothing => putStrLn "ERROR: This part is not implemented yet!"
putStrLn "Input (end with \\):"
input <- trim <$> getInput