From a5a8d7b926bfd415cb69826cc58f03135dd46fd7 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Sun, 6 Dec 2020 07:37:17 +0100 Subject: [PATCH] haskell: simplify runAoC invocations --- 2020/day3/day3.hs | 2 +- 2020/day5/day5.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/2020/day3/day3.hs b/2020/day3/day3.hs index 113a837..7066c47 100644 --- a/2020/day3/day3.hs +++ b/2020/day3/day3.hs @@ -23,6 +23,6 @@ countHits = length . filterMap lookup . catMaybes .: compose2 (zipWith mzip) may treeCharToBool :: Char -> Bool treeCharToBool = (== '#') -main = runAoC (fmap (cycle . map treeCharToBool) <$> lines) part1 part2 +main = runAoC (map (cycle . map treeCharToBool) . lines) part1 part2 where part1 = countHits (3, 1) part2 = product . (fmap countHits [(1,1), (3,1), (5,1), (7,1), (1,2)] ??) diff --git a/2020/day5/day5.hs b/2020/day5/day5.hs index 2aa5dd2..8f518c9 100644 --- a/2020/day5/day5.hs +++ b/2020/day5/day5.hs @@ -18,6 +18,6 @@ findHole (x:y:ys) | y == next = findHole $ y:ys where next = succ x findHole _ = Nothing -main = runAoC (fmap (fromJust . binarify) <$> lines) part1 part2 +main = runAoC (map (fromJust . binarify) . lines) part1 part2 where part1 = foldr1 max part2 = fromJust . findHole . sort