[Haskell-cafe] Lazy vs correct IO [Was: A round of golf]

oleg at okmij.org oleg at okmij.org
Mon Apr 6 00:28:32 EDT 2009


>   It opens and closes each file in turn; but it would it be
>   unwise to open and close each file as we'd read a chunk from
>   it? This would allow arbitrary interleaving.

If I understand you correctly, you are proposing processing several
files in parallel, so to interleave IO. If the `files' in question are
communication pipes, or if KAIO (kernel asynchronous IO) is
available, it is indeed a good strategy. The last example in the file

	http://okmij.org/ftp/Haskell/Iteratee/IterateeM.hs

(called test_driver_mux) demonstrates how to interleave IO with
Iteratees. Iteratees of course do not care how the source data have
been obtained, with or without interleaving.


More information about the Haskell-Cafe mailing list