# Advent of Code 2022 day 1

Another December, another Advent of Code!

Day 1 was another gentle warmup, where I spent most of my time looking at the Data.List.Split library and not seeing the function I needed.

I needed to convert the input into a list of groups of numbers. lines would split the input into lines, then I eventually noticed splitWhen in Data.List.Split did exactly what I needed to split the data into groups. Nested mappings of read did the conversion into numbers.

At this point, part 1 was summing the groups and finding the largest sum. Part 2 involved sorting the group totals and summing the largest three. The code is a direct expression of the problem.

main :: IO ()
main =
do  dataFileName <- getDataFileName
let calories = fmap (fmap (read @Int)) $splitWhen null$ lines numStrs
print $part1 calories print$ part2 calories