Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- openBinaryFile :: OsPath -> IOMode -> IO Handle
- withFile :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
- withBinaryFile :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
- withFile' :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
- withBinaryFile' :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
- readFile :: OsPath -> IO ByteString
- readFile' :: OsPath -> IO ByteString
- writeFile :: OsPath -> ByteString -> IO ()
- writeFile' :: OsPath -> ByteString -> IO ()
- appendFile :: OsPath -> ByteString -> IO ()
- appendFile' :: OsPath -> ByteString -> IO ()
- openFile :: OsPath -> IOMode -> IO Handle
- openExistingFile :: OsPath -> IOMode -> IO Handle
- openFileWithCloseOnExec :: OsPath -> IOMode -> IO Handle
- openExistingFileWithCloseOnExec :: OsPath -> IOMode -> IO Handle
- handleFinalizer :: FilePath -> MVar Handle__ -> IO ()
- type HandleFinalizer = FilePath -> MVar Handle__ -> IO ()
- addHandleFinalizer :: Handle -> HandleFinalizer -> IO ()
- withOpenFile' :: OsPath -> IOMode -> Bool -> Bool -> Bool -> (Handle -> IO r) -> Bool -> IO r
- addFilePathToIOError :: String -> OsPath -> IOException -> IOException
- augmentError :: String -> OsPath -> IO a -> IO a
Documentation
openBinaryFile :: OsPath -> IOMode -> IO Handle Source #
Like openFile
, but open the file in binary mode.
On Windows, reading a file in text mode (which is the default)
will translate CRLF to LF, and writing will translate LF to CRLF.
This is usually what you want with text files. With binary files
this is undesirable; also, as usual under Microsoft operating systems,
text mode treats control-Z as EOF. Binary mode turns off all special
treatment of end-of-line and end-of-file characters.
(See also hSetBinaryMode
.)
withFile :: OsPath -> IOMode -> (Handle -> IO r) -> IO r Source #
Run an action on a file.
The Handle
is automatically closed afther the action.
withFile' :: OsPath -> IOMode -> (Handle -> IO r) -> IO r Source #
Run an action on a file.
The Handle
is not automatically closed to allow lazy IO. Use this
with caution.
readFile :: OsPath -> IO ByteString Source #
The readFile
function reads a file and returns the contents of the file
as a ByteString
. The file is read lazily, on demand.
readFile' :: OsPath -> IO ByteString Source #
The readFile'
function reads a file and returns the contents of the file
as a ByteString
. The file is fully read before being returned.
writeFile :: OsPath -> ByteString -> IO () Source #
The computation writeFile
file str
function writes the lazy ByteString
str
,
to the file file
.
writeFile' :: OsPath -> ByteString -> IO () Source #
The computation writeFile
file str
function writes the strict ByteString
str
,
to the file file
.
appendFile :: OsPath -> ByteString -> IO () Source #
The computation appendFile
file str
function appends the lazy ByteString
str
,
to the file file
.
appendFile' :: OsPath -> ByteString -> IO () Source #
The computation appendFile
file str
function appends the strict ByteString
str
,
to the file file
.
openExistingFile :: OsPath -> IOMode -> IO Handle Source #
Open an existing file and return the Handle
.
addHandleFinalizer :: Handle -> HandleFinalizer -> IO () Source #
withOpenFile' :: OsPath -> IOMode -> Bool -> Bool -> Bool -> (Handle -> IO r) -> Bool -> IO r Source #
addFilePathToIOError :: String -> OsPath -> IOException -> IOException Source #