-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Basic file IO operations via 'OsPath'
--   
--   Basic file IO operations like Prelude, but for <a>OsPath</a>.
@package file-io
@version 0.1.5

module System.File.OsPath.Internal

-- | Like <a>openFile</a>, 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 <a>hSetBinaryMode</a>.)
openBinaryFile :: OsPath -> IOMode -> IO Handle

-- | Run an action on a file.
--   
--   The <a>Handle</a> is automatically closed afther the action.
withFile :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
withBinaryFile :: OsPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Run an action on a file.
--   
--   The <a>Handle</a> is not automatically closed to allow lazy IO. Use
--   this with caution.
withFile' :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
withBinaryFile' :: OsPath -> IOMode -> (Handle -> IO r) -> IO r

-- | The <a>readFile</a> function reads a file and returns the contents of
--   the file as a <tt>ByteString</tt>. The file is read lazily, on demand.
readFile :: OsPath -> IO ByteString

-- | The <a>readFile'</a> function reads a file and returns the contents of
--   the file as a <tt>ByteString</tt>. The file is fully read before being
--   returned.
readFile' :: OsPath -> IO ByteString

-- | The computation <a>writeFile</a> <tt>file str</tt> function writes the
--   lazy <tt>ByteString</tt> <tt>str</tt>, to the file <tt>file</tt>.
writeFile :: OsPath -> ByteString -> IO ()

-- | The computation <a>writeFile</a> <tt>file str</tt> function writes the
--   strict <tt>ByteString</tt> <tt>str</tt>, to the file <tt>file</tt>.
writeFile' :: OsPath -> ByteString -> IO ()

-- | The computation <a>appendFile</a> <tt>file str</tt> function appends
--   the lazy <tt>ByteString</tt> <tt>str</tt>, to the file <tt>file</tt>.
appendFile :: OsPath -> ByteString -> IO ()

-- | The computation <a>appendFile</a> <tt>file str</tt> function appends
--   the strict <tt>ByteString</tt> <tt>str</tt>, to the file
--   <tt>file</tt>.
appendFile' :: OsPath -> ByteString -> IO ()

-- | Open a file and return the <a>Handle</a>.
openFile :: OsPath -> IOMode -> IO Handle

-- | Open an existing file and return the <a>Handle</a>.
openExistingFile :: OsPath -> IOMode -> IO Handle

-- | Open a file and return the <a>Handle</a>.
--   
--   Sets <tt>O_CLOEXEC</tt> on posix.
openFileWithCloseOnExec :: OsPath -> IOMode -> IO Handle

-- | Open an existing file and return the <a>Handle</a>.
--   
--   Sets <tt>O_CLOEXEC</tt> on posix.
openExistingFileWithCloseOnExec :: OsPath -> IOMode -> IO Handle

-- | The function creates a temporary file in ReadWrite mode. The created
--   file isn't deleted automatically, so you need to delete it manually.
--   
--   The file is created with permissions such that only the current user
--   can read/write it.
--   
--   With some exceptions (see below), the file will be created securely in
--   the sense that an attacker should not be able to cause openTempFile to
--   overwrite another file on the filesystem using your credentials, by
--   putting symbolic links (on Unix) in the place where the temporary file
--   is to be created. On Unix the <tt>O_CREAT</tt> and <tt>O_EXCL</tt>
--   flags are used to prevent this attack, but note that <tt>O_EXCL</tt>
--   is sometimes not supported on NFS filesystems, so if you rely on this
--   behaviour it is best to use local filesystems only.
openTempFile :: OsPath -> OsString -> IO (OsPath, Handle)

-- | Like <a>openTempFile</a>, but opens the file in binary mode. See
--   <a>openBinaryFile</a> for more comments.
openBinaryTempFile :: OsPath -> OsString -> IO (OsPath, Handle)

-- | Like <a>openTempFile</a>, but uses the default file permissions
openTempFileWithDefaultPermissions :: OsPath -> OsString -> IO (OsPath, Handle)

-- | Like <a>openBinaryTempFile</a>, but uses the default file permissions
openBinaryTempFileWithDefaultPermissions :: OsPath -> OsString -> IO (OsPath, Handle)
handleFinalizer :: FilePath -> MVar Handle__ -> IO ()
type HandleFinalizer = FilePath -> MVar Handle__ -> IO ()

-- | Add a finalizer to a <a>Handle</a>. Specifically, the finalizer will
--   be added to the <a>MVar</a> of a file handle or the write-side
--   <a>MVar</a> of a duplex handle. See Handle Finalizers for details.
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
openTempFile' :: String -> OsPath -> OsString -> Bool -> CMode -> IO (OsPath, Handle)
any_ :: (OsChar -> Bool) -> OsString -> Bool


-- | This module mimics base API wrt file IO, but using <tt>OsPath</tt>.
module System.File.OsPath

-- | Like <a>openFile</a>, 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 <a>hSetBinaryMode</a>.)
openBinaryFile :: OsPath -> IOMode -> IO Handle

-- | Run an action on a file.
--   
--   The <a>Handle</a> is automatically closed afther the action.
withFile :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
withBinaryFile :: OsPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Run an action on a file.
--   
--   The <a>Handle</a> is not automatically closed to allow lazy IO. Use
--   this with caution.
withFile' :: OsPath -> IOMode -> (Handle -> IO r) -> IO r
withBinaryFile' :: OsPath -> IOMode -> (Handle -> IO r) -> IO r

-- | The <a>readFile</a> function reads a file and returns the contents of
--   the file as a <tt>ByteString</tt>. The file is read lazily, on demand.
readFile :: OsPath -> IO ByteString

-- | The <a>readFile'</a> function reads a file and returns the contents of
--   the file as a <tt>ByteString</tt>. The file is fully read before being
--   returned.
readFile' :: OsPath -> IO ByteString

-- | The computation <a>writeFile</a> <tt>file str</tt> function writes the
--   lazy <tt>ByteString</tt> <tt>str</tt>, to the file <tt>file</tt>.
writeFile :: OsPath -> ByteString -> IO ()

-- | The computation <a>writeFile</a> <tt>file str</tt> function writes the
--   strict <tt>ByteString</tt> <tt>str</tt>, to the file <tt>file</tt>.
writeFile' :: OsPath -> ByteString -> IO ()

-- | The computation <a>appendFile</a> <tt>file str</tt> function appends
--   the lazy <tt>ByteString</tt> <tt>str</tt>, to the file <tt>file</tt>.
appendFile :: OsPath -> ByteString -> IO ()

-- | The computation <a>appendFile</a> <tt>file str</tt> function appends
--   the strict <tt>ByteString</tt> <tt>str</tt>, to the file
--   <tt>file</tt>.
appendFile' :: OsPath -> ByteString -> IO ()

-- | Open a file and return the <a>Handle</a>.
openFile :: OsPath -> IOMode -> IO Handle

-- | Open an existing file and return the <a>Handle</a>.
openExistingFile :: OsPath -> IOMode -> IO Handle

-- | The function creates a temporary file in ReadWrite mode. The created
--   file isn't deleted automatically, so you need to delete it manually.
--   
--   The file is created with permissions such that only the current user
--   can read/write it.
--   
--   With some exceptions (see below), the file will be created securely in
--   the sense that an attacker should not be able to cause openTempFile to
--   overwrite another file on the filesystem using your credentials, by
--   putting symbolic links (on Unix) in the place where the temporary file
--   is to be created. On Unix the <tt>O_CREAT</tt> and <tt>O_EXCL</tt>
--   flags are used to prevent this attack, but note that <tt>O_EXCL</tt>
--   is sometimes not supported on NFS filesystems, so if you rely on this
--   behaviour it is best to use local filesystems only.
openTempFile :: OsPath -> OsString -> IO (OsPath, Handle)

-- | Like <a>openTempFile</a>, but opens the file in binary mode. See
--   <a>openBinaryFile</a> for more comments.
openBinaryTempFile :: OsPath -> OsString -> IO (OsPath, Handle)

-- | Like <a>openTempFile</a>, but uses the default file permissions
openTempFileWithDefaultPermissions :: OsPath -> OsString -> IO (OsPath, Handle)

-- | Like <a>openBinaryTempFile</a>, but uses the default file permissions
openBinaryTempFileWithDefaultPermissions :: OsPath -> OsString -> IO (OsPath, Handle)

module System.File.PlatformPath.Internal

-- | Like <a>openBinaryFile</a>, but takes a <a>PlatformPath</a> instead of
--   an <a>OsPath</a>.
openBinaryFile :: PlatformPath -> IOMode -> IO Handle

-- | Like <a>withFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
withFile :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>withBinaryFile</a>, but takes a <a>PlatformPath</a> instead of
--   an <a>OsPath</a>.
withBinaryFile :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>withFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
withFile' :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>withBinaryFile'</a>, but takes a <a>PlatformPath</a> instead
--   of an <a>OsPath</a>.
withBinaryFile' :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>readFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
readFile :: PlatformPath -> IO ByteString

-- | Like <a>readFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
readFile' :: PlatformPath -> IO ByteString

-- | Like <a>writeFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
writeFile :: PlatformPath -> ByteString -> IO ()

-- | Like <a>writeFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
writeFile' :: PlatformPath -> ByteString -> IO ()

-- | Like <a>appendFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
appendFile :: PlatformPath -> ByteString -> IO ()

-- | Like <a>appendFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
appendFile' :: PlatformPath -> ByteString -> IO ()

-- | Like <a>openFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
openFile :: PlatformPath -> IOMode -> IO Handle

-- | Like <a>openExistingFile</a>, but takes a <a>PlatformPath</a> instead
--   of an <a>OsPath</a>.
openExistingFile :: PlatformPath -> IOMode -> IO Handle

-- | Open a file and return the <a>Handle</a>.
--   
--   Sets <tt>O_CLOEXEC</tt> on posix.
openFileWithCloseOnExec :: PlatformPath -> IOMode -> IO Handle

-- | Open an existing file and return the <a>Handle</a>.
--   
--   Sets <tt>O_CLOEXEC</tt> on posix.
openExistingFileWithCloseOnExec :: PlatformPath -> IOMode -> IO Handle
handleFinalizer :: FilePath -> MVar Handle__ -> IO ()
type HandleFinalizer = FilePath -> MVar Handle__ -> IO ()

-- | Add a finalizer to a <a>Handle</a>. Specifically, the finalizer will
--   be added to the <a>MVar</a> of a file handle or the write-side
--   <a>MVar</a> of a duplex handle. See Handle Finalizers for details.
addHandleFinalizer :: Handle -> HandleFinalizer -> IO ()
withOpenFile' :: PlatformPath -> IOMode -> Bool -> Bool -> Bool -> (Handle -> IO r) -> Bool -> IO r
addFilePathToIOError :: String -> PlatformPath -> IOException -> IOException
augmentError :: String -> PlatformPath -> IO a -> IO a


-- | This module is only interesting when you are implementing low-level
--   libraries based on <tt>OsPath</tt> API.
--   
--   Usually you want <a>System.File.OsPath</a>.
module System.File.PlatformPath

-- | Like <a>openBinaryFile</a>, but takes a <a>PlatformPath</a> instead of
--   an <a>OsPath</a>.
openBinaryFile :: PlatformPath -> IOMode -> IO Handle

-- | Like <a>withFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
withFile :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>withBinaryFile</a>, but takes a <a>PlatformPath</a> instead of
--   an <a>OsPath</a>.
withBinaryFile :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>withFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
withFile' :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>withBinaryFile'</a>, but takes a <a>PlatformPath</a> instead
--   of an <a>OsPath</a>.
withBinaryFile' :: PlatformPath -> IOMode -> (Handle -> IO r) -> IO r

-- | Like <a>readFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
readFile :: PlatformPath -> IO ByteString

-- | Like <a>readFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
readFile' :: PlatformPath -> IO ByteString

-- | Like <a>writeFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
writeFile :: PlatformPath -> ByteString -> IO ()

-- | Like <a>writeFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
writeFile' :: PlatformPath -> ByteString -> IO ()

-- | Like <a>appendFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
appendFile :: PlatformPath -> ByteString -> IO ()

-- | Like <a>appendFile'</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
appendFile' :: PlatformPath -> ByteString -> IO ()

-- | Like <a>openFile</a>, but takes a <a>PlatformPath</a> instead of an
--   <a>OsPath</a>.
openFile :: PlatformPath -> IOMode -> IO Handle

-- | Like <a>openExistingFile</a>, but takes a <a>PlatformPath</a> instead
--   of an <a>OsPath</a>.
openExistingFile :: PlatformPath -> IOMode -> IO Handle
