her.esy.fun/src/posts/0010-Haskell-Now/io_sum.hs

8 lines
190 B
Haskell
Raw Normal View History

2019-12-25 21:17:22 +00:00
toList :: String -> [Integer]
toList input = read ("[" ++ input ++ "]")
main = do
putStrLn "Enter a list of numbers (separated by comma):"
input <- getLine
print $ sum (toList input)