From c9666b358b478effbbc23203348a3b8d38659d8e Mon Sep 17 00:00:00 2001 From: germax26 Date: Tue, 3 Dec 2024 08:15:27 +1100 Subject: [PATCH] Update aoc.hs --- 2015/day07/day07.hs | 2 +- aoc.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/2015/day07/day07.hs b/2015/day07/day07.hs index ba042d4..8dcd381 100644 --- a/2015/day07/day07.hs +++ b/2015/day07/day07.hs @@ -45,4 +45,4 @@ part2 :: [(String, (Op, String, String))] -> Int -> Int part2 wires part1Answer = fst $ eval'' wires [("b", part1Answer)] "a" main :: IO () -main = aocMain' parseFile (passthrough . part1) part2 \ No newline at end of file +main = aocMain' parseFile (dup . part1) part2 \ No newline at end of file diff --git a/aoc.hs b/aoc.hs index 8bc603e..b030b74 100644 --- a/aoc.hs +++ b/aoc.hs @@ -9,10 +9,10 @@ aocMain' parseFile part1 part2 = do let part2Answer = part2 input data' putStrLn $ "Part 2: " ++ show part2Answer -passthrough :: a -> (a, a) -passthrough a = (a, a) +dup :: a -> (a, a) +dup a = (a, a) -aocMain :: Show p => ([String] -> p) -> (p -> Int) -> (p -> Int) -> IO () +aocMain :: (Show p, Show a) => ([String] -> p) -> (p -> a) -> (p -> a) -> IO () aocMain parseFile part1 part2 = aocMain' parseFile ((,()) . part1) (const' part2) const' :: (a -> b) -> a -> c -> b @@ -21,7 +21,7 @@ const' f a _ = f a enumerate :: [a] -> [(Int, a)] enumerate = zip [0..] -unimplemented :: Show p => p -> Int +unimplemented :: (Show p, Show a) => p -> a unimplemented = error . show pair :: [a] -> (a, a)