[Haskell-cafe] Input/Output file

Stefan Holdermans stefan at cs.uu.nl
Mon Jul 3 10:53:02 EDT 2006


Sara,

> --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.


Could it be that the input file has a trailing return or something  
similar?

You could easily test this by making a small change to your test  
function:

   test s
         | ...
         | ...
         | otherwise = error $ "The file contains: " ++ s

HTH,

   Stefan


More information about the Haskell-Cafe mailing list