I am writing a program that reads and writes to the same file.  I was having some 
problems with it writing to the file before it read it.  I solved it in the following 
two ways:

1.
main = do text <- readFile "test"
          let something = somefunc text
          writeFile "test2" something
          renameFile "test2" "test"

2.
main = do text <- readFile "test"
          let something = somefunc text
          writeFile "test" $! something

Are both of these correct (guaranteed to give the behavior I want)?  Which is better 
(and why)?

Thanks!
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to