-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | High-level filesystem interaction
--
-- This is a small wrapper around the "directory", "unix", and "Win32"
-- packages for use with "system-filepath".
@package system-fileio
@version 0.2
-- | Simple FilePath‐aware wrappers around standard System.IO
-- computations. See the linked documentation for each computation for
-- details on exceptions and operating system interaction.
module System.File
-- | Haskell defines operations to read and write characters from and to
-- files, represented by values of type Handle. Each value of
-- this type is a handle: a record used by the Haskell run-time
-- system to manage I/O with file system objects. A handle has at
-- least the following properties:
--
--
-- - whether it manages input or output or both;
-- - whether it is open, closed or
-- semi-closed;
-- - whether the object is seekable;
-- - whether buffering is disabled, or enabled on a line or block
-- basis;
-- - a buffer (whose length may be zero).
--
--
-- Most handles will also have a current I/O position indicating where
-- the next input or output operation will occur. A handle is
-- readable if it manages only input or both input and output;
-- likewise, it is writable if it manages only output or both
-- input and output. A handle is open when first allocated. Once
-- it is closed it can no longer be used for either input or output,
-- though an implementation cannot re-use its storage while references
-- remain to it. Handles are in the Show and Eq classes.
-- The string produced by showing a handle is system dependent; it should
-- include enough information to identify the handle for debugging. A
-- handle is equal according to == only to itself; no attempt is
-- made to compare the internal state of different handles for equality.
data Handle :: *
-- | See System.IO.openFile
data IOMode :: *
ReadMode :: IOMode
WriteMode :: IOMode
AppendMode :: IOMode
ReadWriteMode :: IOMode
-- | Copy a file to a new entry in the filesystem. If a file already exists
-- at the new location, it will be replaced.
--
-- See: copyFile
--
-- Since: 0.1.1
copyFile :: FilePath -> FilePath -> IO ()
-- | Get when the object at a given path was last modified.
--
-- Since: 0.2
getModified :: FilePath -> IO UTCTime
-- | Get the size of an object at a given path. For special objects like
-- links or directories, the size is filesystem‐ and platform‐dependent.
--
-- Since: 0.2
getSize :: FilePath -> IO Integer
-- | Open a file in binary mode, and return an open Handle. The
-- Handle should be hClosed when it is no longer needed.
--
-- withFile is easier to use, because it will handle the
-- Handle’s lifetime automatically.
--
-- See: openBinaryFile
openFile :: FilePath -> IOMode -> IO Handle
-- | Open a file in binary mode, and pass its Handle to a provided
-- computation. The Handle will be automatically closed when the
-- computation returns.
--
-- See: withBinaryFile
withFile :: FilePath -> IOMode -> (Handle -> IO a) -> IO a
-- | Read in the entire contents of a binary file.
--
-- See: readFile
readFile :: FilePath -> IO ByteString
-- | Replace the entire contents of a binary file with the provided
-- ByteString.
--
-- See: writeFile
writeFile :: FilePath -> ByteString -> IO ()
-- | Append a ByteString to a file. If the file does not exist, it
-- will be created.
--
-- See: appendFile
appendFile :: FilePath -> ByteString -> IO ()
-- | Open a file in text mode, and return an open Handle. The
-- Handle should be hClosed when it is no longer needed.
--
-- withTextFile is easier to use, because it will handle the
-- Handle’s lifetime automatically.
--
-- See: openFile
openTextFile :: FilePath -> IOMode -> IO Handle
-- | Open a file in text mode, and pass its Handle to a provided
-- computation. The Handle will be automatically closed when the
-- computation returns.
--
-- See: withFile
withTextFile :: FilePath -> IOMode -> (Handle -> IO a) -> IO a
-- | Read in the entire contents of a text file.
--
-- See: readFile
readTextFile :: FilePath -> IO Text
-- | Replace the entire contents of a text file with the provided
-- Text.
--
-- See: writeFile
writeTextFile :: FilePath -> Text -> IO ()
-- | Append Text to a file. If the file does not exist, it will be
-- created.
--
-- See: appendFile
appendTextFile :: FilePath -> Text -> IO ()
-- | Simple FilePath‐aware wrappers around standard
-- System.Directory computations. See the linked documentation for
-- each computation for details on exceptions and operating system
-- interaction.
module System.Directory
-- | Check if a file exists at the given path.
--
-- See: doesFileExist
isFile :: FilePath -> IO Bool
-- | Check if a directory exists at the given path.
--
-- See: doesDirectoryExist
isDirectory :: FilePath -> IO Bool
-- | Rename a filesystem object. Some operating systems have restrictions
-- on what objects can be renamed; see linked documentation for details.
--
-- See: renameFile and renameDirectory
rename :: FilePath -> FilePath -> IO ()
canonicalizePath :: FilePath -> IO FilePath
-- | List contents of a directory, excluding "." and
-- "..".
--
-- See: getDirectoryContents
listDirectory :: FilePath -> IO [FilePath]
-- | Create a directory at a given path. The user may choose whether it is
-- an error for a directory to already exist at that path.
--
-- See: createDirectory.
createDirectory :: Bool -> FilePath -> IO ()
-- | Create a directory at a given path, including any parents which might
-- be missing.
--
-- See: createDirectoryIfMissing
createTree :: FilePath -> IO ()
-- | Remove a file.
--
-- See: removeFile
removeFile :: FilePath -> IO ()
-- | Remove an empty directory.
--
-- See: removeDirectory
removeDirectory :: FilePath -> IO ()
-- | Recursively remove a directory tree rooted at the given path.
--
-- See: removeDirectoryRecursive
removeTree :: FilePath -> IO ()
-- | Get the current working directory.
--
-- See: getCurrentDirectory
getWorkingDirectory :: IO FilePath
-- | Set the current working directory.
--
-- See: setCurrentDirectory
setWorkingDirectory :: FilePath -> IO ()
-- | Get the user’s home directory. This is useful for building paths to
-- more specific directories.
--
-- For directing the user to open or safe a document, use
-- getDocumentsDirectory.
--
-- For data files the user does not explicitly create, such as automatic
-- saves, use getAppDataDirectory.
--
-- See: getHomeDirectory
getHomeDirectory :: IO FilePath
-- | Get the user’s home directory. This is a good starting point for file
-- dialogs and other user queries. For data files the user does not
-- explicitly create, such as automatic saves, use
-- getAppDataDirectory.
getDesktopDirectory :: IO FilePath
-- | Get the user’s documents directory. This is a good place to save
-- user-created files. For data files the user does not explicitly
-- create, such as automatic saves, use getAppDataDirectory.
--
-- See: getUserDocumentsDirectory
getDocumentsDirectory :: IO FilePath
-- | Get the user’s application data directory, given an application label.
-- This directory is where applications should store data the user did
-- not explicitly create, such as databases and automatic saves.
--
-- See: getAppUserDataDirectory
getAppDataDirectory :: Text -> IO FilePath
-- | Get the user’s application cache directory, given an application
-- label. This directory is where applications should store caches, which
-- might be large and can be safely deleted.
getAppCacheDirectory :: Text -> IO FilePath
-- | Get the user’s application configuration directory, given an
-- application label. This directory is where applications should store
-- their configurations and settings.
getAppConfigDirectory :: Text -> IO FilePath