
On Tue, Sep 12, 2006 at 09:00:19AM -0400,
Sara Kenedy
Maybe what I talk is not clear.
Do not worry, not all the haskell-cafe readers speak english. (I'm french, for instance.)
I want to take the input string sss of "update" to use in: writeFile "myFile.txt" sss of function "main" and get the value zzz from "main" to assign for the value return of "update".
From a newbie to another newbie: I do not think it is possible. "There is no way out of the IO monad, once you're in it."
See the explanations in the page indicated by Henning Thielemann : http://haskell.org/hawiki/ThatAnnoyingIoType This should work (not tested): update :: String -> IO String update sss = do writeFile "myFile.txt" sss x <- callSystem "myFile.txt" y <- openFile "result.txt" ReadMode zzz <- hGetContents y return zzz main = update "Foobar"