[Haskell] the wonders of lazy IO

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Mon Apr 18 11:11:31 EDT 2005

it took me quite a while to isolate the following.

what does this program print? certainly "A"
(written by the first system call) is different from "B"?

import System

main = do
     system "echo A > foo"
     a <- readFile "foo"
     system "echo B > foo"
     b <- readFile "foo"
     print (a == b)

best regards,
-- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 --
---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

More information about the Haskell mailing list