> Arguably, readFile is too strict: why is the file opened, if there
> aren't any characters needed. What is the motivation for opening the
> file eagerly?
Once we've started reading lazilly, it's hard to generate errors. The file
is opened eagerly so that any errors generated (such as if the file doesn't
exist) can be propogated immediately to the caller.
I checked the Haskell Report, which doesn't seem to specify the correct
behaviour - I guess this should be clarified. The report also contains the
sentence "The exceptions raised by the I/O functions in the Prelude are
defined in the Library Report", but I can't find any reference to
readFile/writeFile in the library report.
Cheers,
Simon
- openFile, process file table full Jan Kort
- RE: openFile, process file table full Simon Marlow
- RE: openFile, process file table full Marko Schuetz
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- RE: openFile, process file table full Simon Marlow
- RE: openFile, process file table full Simon Marlow
- Re: openFile, process file table full George Russell
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- Re: openFile, process file table full Jan Kort
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- Re: openFile, process file table full Ch. A. Herrmann
- Re: openFile, process file table full Marcin 'Qrczak' Kowalczyk
- RE: openFile, process file table full Simon Marlow
- Re: openFile, process file table full Jan Kort
- RE: openFile, process file table full Josef Svenningsson
