[Haskell-beginners] IO vars

Corentin Dupont corentin.dupont at gmail.com
Wed Aug 29 10:58:58 CEST 2012


Hi all,
there is something very basic that it seems escaped me.
For example with the following program f and g have type IO () and I can
thread a value between the two using a file.
Can I do the exact same (not changing the types of f and g) without a file?*

f,g :: IO ()
**f = withFile "toto" WriteMode (flip hPutStr "toto")
g = withFile "toto" ReadMode hGetLine >>= putStrLn
main = f >> g*

Thanks and cheers,
Corentin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120829/43c5919f/attachment.htm>


More information about the Beginners mailing list