| ||||
| ||||
Synopsis | ||||
| ||||
Documentation | ||||
readFile :: FilePath -> IO String | ||||
The readFile function reads a file and returns the contents of the file as a string. The file is read lazily, on demand, as with getContents. | ||||
hGetContents :: Handle -> IO String | ||||
Computation hGetContents hdl returns the list of characters corresponding to the unread portion of the channel or file managed by hdl, which is put into an intermediate state, semi-closed. In this state, hdl is effectively closed, but items are read from hdl on demand and accumulated in a special list returned by hGetContents hdl. Any operation that fails because a handle is closed, also fails if a handle is semi-closed. The only exception is hClose. A semi-closed handle becomes closed:
Once a semi-closed handle becomes closed, the contents of the associated list becomes fixed. The contents of this final list is only partially specified: it will contain at least all the items of the stream that were evaluated prior to the handle becoming closed. Any I/O errors encountered while a handle is semi-closed are simply discarded. This operation may fail with:
| ||||
Produced by Haddock version 2.6.0 |