Compare commits
No commits in common. "41c77cc0b5707497f4e1bac9de8cf530cd9dbca3" and "67d9d55cfa2a9b4c6aac11680e08a8a5dd57486f" have entirely different histories.
41c77cc0b5
...
67d9d55cfa
|
@ -11,11 +11,15 @@ run = do
|
|||
|
||||
part1 :: [String] -> IO ()
|
||||
part1 calibrationLines =
|
||||
putStrLn $ "Part 1 Answer: " <> show (answer id id calibrationLines)
|
||||
printAnswer 1 (answer id id calibrationLines)
|
||||
|
||||
part2 :: [String] -> IO ()
|
||||
part2 calibrationLines =
|
||||
putStrLn $ "Part 2 Answer: " <> show (answer detectDigits detectReverseDigits calibrationLines)
|
||||
printAnswer 2 (answer detectDigits detectReverseDigits calibrationLines)
|
||||
|
||||
printAnswer :: Int -> Either String Int -> IO ()
|
||||
printAnswer part (Left err) = putStrLn $ "Part " <> show part <> " Error: " <> err
|
||||
printAnswer part (Right ans) = putStrLn $ "Part " <> show part <> " Answer: " <> show ans
|
||||
|
||||
answer :: (String -> String) -> (String -> String) -> [String] -> Either String Int
|
||||
answer preprocessorFirst preprocessorLast calibrationLines =
|
||||
|
|
Loading…
Reference in New Issue