I am getting a parse error on input '=' when trying to run the following code
module GiveNums
where
import System.IO
main = do
hSetBuffering stdin LineBuffering
n <- giveNum
sum = map (+) n
putStrLn "The sum is " ++ show sum
giveNum = do
hSetBuffering stdin LineBuffering
putStrLn "Enter num"
num <- getLine
if read num == 0
then return []
else do
rest <- giveNum
return ((read num :: Int: rest)
let var = expr. Also:map (+) nwon't give a single number but a list of functions, you probably want fold. Also:f x :: ty : xswon't parse right you need parens such as(f x :: ty) : xs).sumis already taken as a variable name, it's the name of a function. Do a:t sumand a:i sumin ghci, or search it. I'd suggest that you comment out yourmainfunction for now and get yourgiveNumfunction working. It's really close to working, especially with Thomas' last suggestion. Then, oncegiveNumworks, start onmain.