1
0
Fork 0
advent-of-code/2020/01/part1.hs
2022-09-21 09:19:52 -04:00

16 lines
295 B
Haskell
Executable file

#!/usr/bin/env runghc
import Data.List
import Data.Maybe
main = interact findSolution
findSolution = show . product . findJust isSolutionPair . pairs . parseInput
parseInput = map read . lines
pairs = sequence . replicate 2
isSolutionPair = (2020 ==) . sum
findJust f = fromJust . find f