Haskell file reading
I have just recently started learning Haskell and I am having a lot of trouble trying to figure out how the file reading works. For example, I have a text file "test.txt" And it contains lines of numbers eg: 32 4 2 30 300 5 I want to read each line and then evaluate each word and add them. Thus I am trying to do something like this so far: import System.IO import Control.Monad main = do let list = [] handle <- openFile "test.txt" ReadMode contents <- hGetContents handle singlewords <- (words contents) list <- f singlewords print list hClose handle f :: [String] -> [Int] f = map read I know