
Hi, I'm solving the following problem - I need to use an external application - give it the input data and receive its output. However, when multiple calls are made, the results are not as expected. The simplified version of the problem is given below: import System.Cmd main = do System.Cmd.system "echo hello >output.txt" -- use the external application to create an output file o1 <- readFile "output.txt" System.Cmd.system "echo bye >output.txt" -- the second call to the external application o2 <- readFile "output.txt" putStr o1 -- "hello" expected, but "bye" printed return 0 Can you please give me some hint to solve this problem? I'm a beginning haskell developer and I'm still a bit confused by the IO monad. Thank you in advance. Petr