[Haskell-cafe] Input/Output file
Sara Kenedy
sarakenedy at gmail.com
Mon Jul 3 10:43:53 EDT 2006
Hi all,
I have a module Test.hs:
module Test where
import IO
readMsgFile = do
putStr "Input file: "
ifile <- getLine
putStr "Output file: "
ofile <- getLine
s <- readFile ifile
writeFile ofile (test s)
--test function
test :: String -> String
test s
|s == "true" = "True"
|s == "false" = "False"
|otherwise = []
Then, I run
*Test> readMsgFile
Input file: test1.txt
Output file: result1.txt
The content of test1.txt is string "true". So I expect the result in
"result1.txt" is "True"
But, open file "result1.txt", it displays empty.
I do not know why it does not return correct answer. If you don't
mind, please share with me. Thanks a lot.
S.
More information about the Haskell-Cafe
mailing list