[Haskell-cafe] Lazier I/O?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Nov 28 07:46:00 EST 2005


On Mon, 2005-11-28 at 07:27 -0500, Dimitry Golubovsky wrote:
> This may be a stupud question, but how to make I/O in Haskell really lazy?
> 
> What is desired is to have the IO actions perform as their results are 
> needed. I am assuming some knowledge that those actions have only 
> limited scope of side effects (e. g. order of outputs within a window is 
> significant, but order of appearance of those windows on the screen may 
> not be). I see some way to do this by writing regular non-monadic 
> Haskell stuff, representing each side effects scope (i. e. where 
> ordering of actions is necessary) with its own instance of an I/O like 
> monad (but runnable from an outside non-monadic code), and then using 
> unsafePerformIO as needed. But there may be some framework already 
> developed (albeit with unsafePerformIO, but hiding it from application 
> developers).
> 
> Any ideas, pointers?

unsafeInterleaveIO

http://haskell.org/ghc/docs/latest/html/libraries/base/System-IO-Unsafe.html#v%3AunsafeInterleaveIO

Duncan



More information about the Haskell-Cafe mailing list