
Hello, everyone. Hello, I don't understand very well what you're trying to do in your code, but if it is simply reading from a file and put the output into another file
On 12/14/2010 07:24 AM, Sok H. Chang wrote: there is a better way: 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 return () else do inpStr <- hGetLine inh hPutStrLn outh inpStr mainloop inh outh I hope I've understood the problem.. In your code 'inpStr' wasn't in scope, because you've declared it only into else block.. Luca