Begin Day 4, implement parser
[adventofcode2018.git] / day01 / part1.hs
CommitLineData
b2f8fbc5
JK
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)