I am trying to read a string from keyboard. This is my code so far:
getLine :: IO String
getLine = do x <- getChar if x=='\n' then return [] else do xs<-getLine return (x:xs)
The problem is that I get this error when compiling:
parse error on input 'if'
Any ideas what I am doing wrong?