Hello, everyone.
Now, I don't know how can I fix this.
Haskell>ghc --make Temp.hs -o Temp.exe
[1 of 1] Compiling Main ( Temp.hs, Temp.o )
Temp.hs:19:27: Not in scope: `inpStr'
The code is,
import System.IO
import System.Random
sentenceAry = []
main :: IO ()
main = do inh <- openFile "c:\\Documents and Settings\\shaegis\\inputFile.txt" ReadMode
outh <- openFile "c:\\Documents and Settings\\shaegis\\outputFile.txt" WriteMode
mainloop inh outh
hClose inh
hClose outh
mainloop :: Handle -> Handle -> IO ()
mainloop inh outh = do ineof <- hIsEOF inh
if ineof
then do hPutStrLn outh inpStr
return ()
else do inpStr <- hGetLine inh
let sentenceAry = inpStr : []
mainloop inh outh
I'm try to change like below, but I failed.
mainloop :: Handle -> Handle -> IO ()
mainloop inh outh = do ineof <- hIsEOF inh
if not ineof
then do inpStr <- hGetLine inh
let sentenceAry = inpStr : []
mainloop inh outh
else do hPutStrLn outh inpStr
return ()
I wonder why...
Thank you.
Sincerely, Sok Chang