aboutsummaryrefslogtreecommitdiff
path: root/2022/01/first.hs
blob: 300ca7da25a014ceb800a654d55d25e750a4459b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
-- requires cabal install --lib split
module Main where

import Data.List (sort)
import Data.List.Split (splitOn)

parseAndSum :: String -> [Int]
parseAndSum = map (sum . map read . lines) . splitOn "\n\n"

main :: IO ()
main = do
    input <- readFile "input"
    print . head . reverse . sort $ parseAndSum input