]> localhost Git - adventofcode2018.git/blame_incremental - day01/part1.hs
Begin Day 4, implement parser
[adventofcode2018.git] / day01 / part1.hs
... / ...
CommitLineData
1main = do
2 contents <- getContents
3 print . sum $ map toInt (lines contents)
4
5toInt :: String -> Int
6toInt (x:xs) = if x == '+'
7 then read xs :: Int
8 else -(read xs :: Int)