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)