Hi all,
I recently finished up writing streaming facilities via libarchive
bindings and lazy bytestrings. It ended up working nicely -
reading from a file lazily and then unpacking the archive was more
efficient in time + allocations than reading the file all at once.
That got me thinking - what exactly is wrong with lazy I/O? I've
seen Oleg Kiselyov's paper
(http://okmij.org/ftp/Haskell/#lazyIO-not-True) and I've run into
issues myself (basically the issue here:
https://stackoverflow.com/questions/31342012/read-and-writing-to-file-in-haskell),
but none of those seem so pathological - the second issue could be
better resolved with linear types!
Are the any explanations of why Haskell *does* use lazy I/O?
Laziness allows symmetries between values and generators of values
- surely it is not *that* immoral to enforce this even in the IO
monad?
Cheers,
Vanessa McHale