RE: re-opening a closed stdin?

"Simon Marlow"
writes: One reason, I think, is lazy I/O(*). It's to stop you accidentally
[...]
(*) kill it! die! die!
So you want main = readFile "/dev/zero" >> return () to terminate violantly rather than terminate peacefully? :)
Seriously, I understand that the IO monad is the most intuitive and robust when it is strict. But sometimes it is also nice if one could map a file to a lazy string.
It is nice, but it introduces too many problems. What happens to any I/O errors encountered by the lazy I/O? They have to be discarded, which means you can't effectively use lazy I/O for robust applications anyway. Cheers, Simon

Simon Marlow:
[Lazy I/O] is nice, but it introduces too many problems. What happens to any I/O errors encountered by the lazy I/O? They have to be discarded, which means you can't effectively use lazy I/O for robust applications anyway.
Surely they are thrown as exceptions which can then be manipulated in pure code using mapExceptions :: (Exception -> Exception) -> (a -> a) and caught in the IO monad using catch? -- Alastair

On Mon, Nov 25, 2002 at 10:09:01AM -0000, Simon Marlow wrote:
It is nice, but it introduces too many problems. What happens to any I/O errors encountered by the lazy I/O? They have to be discarded, which means you can't effectively use lazy I/O for robust applications anyway.
*mumble*Exceptions*mumble*, but that of course opens another can of worms... Maybe something similar to exceptions, but better suited to laziness... somehow... hmm... Cheers, Michael p.s.: [x] Lazy I/O must die, just for the record. :)
participants (3)
-
Alastair Reid
-
Michael Weber
-
Simon Marlow