I'm having some problems with parsing the code. I'm getting the following error message :
project.hs:82:17: error: parse error on input ‘<-’ Perhaps this statement should be within a 'do' block?
The code is the following :
firstLetters_main :: IO()
firstLetters_main = do
system "cls"
putStr "Input file : "
op1 <- getLine
putStr "Output file : "
op2 <- getLine
let ans1 = read op1
let ans2 = read op2
istream <- readFile ans1
ostream <- openFile ans2 WriteMode
let str = lines istream
hPutStrLn ostream (show (firstLetters str))
The error message points to the line :
ostream <- openFile ans2 WriteMode
This program is changing every sentences starting words first letter to upper case if it isn't already( firstLetters ) without changing the input files structure, in case it has more lines, and puts it in an output file.
Thanks in advance!