haskell: simplify runAoC invocations

This commit is contained in:
Xiretza 2020-12-06 07:37:17 +01:00
parent b1ac705f73
commit 1900e5128b
Signed by: xiretza
GPG Key ID: 17B78226F7139993
2 changed files with 2 additions and 2 deletions

View File

@ -23,6 +23,6 @@ countHits = length . filterMap lookup . catMaybes .: compose2 (zipWith mzip) may
treeCharToBool :: Char -> Bool treeCharToBool :: Char -> Bool
treeCharToBool = (== '#') treeCharToBool = (== '#')
main = runAoC (fmap (cycle . map treeCharToBool) <$> lines) part1 part2 main = runAoC (map (cycle . map treeCharToBool) . lines) part1 part2
where part1 = countHits (3, 1) where part1 = countHits (3, 1)
part2 = product . (fmap countHits [(1,1), (3,1), (5,1), (7,1), (1,2)] ??) part2 = product . (fmap countHits [(1,1), (3,1), (5,1), (7,1), (1,2)] ??)

View File

@ -18,6 +18,6 @@ findHole (x:y:ys) | y == next = findHole $ y:ys
where next = succ x where next = succ x
findHole _ = Nothing findHole _ = Nothing
main = runAoC (fmap (fromJust . binarify) <$> lines) part1 part2 main = runAoC (map (fromJust . binarify) . lines) part1 part2
where part1 = foldr1 max where part1 = foldr1 max
part2 = fromJust . findHole . sort part2 = fromJust . findHole . sort