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

-- | High-level, byte-based file and directory path manipulations (deprecated)
--   
--   High-level, byte-based file and directory path manipulations
--   (deprecated).
@package system-filepath
@version 0.4.14.1

-- | High‐level, byte‐based file and directory path manipulations. You
--   probably want to import Filesystem.Path.CurrentOS instead,
--   since it handles detecting which rules to use in the current
--   compilation.
module Filesystem.Path
data FilePath

-- | A file path with no root, directory, or filename
empty :: FilePath

-- | 
--   null p = (p == empty)
--   
null :: FilePath -> Bool

-- | Retrieves the FilePath’s root.
root :: FilePath -> FilePath

-- | Retrieves the FilePath’s directory. If the path is already a
--   directory, it is returned unchanged.
directory :: FilePath -> FilePath

-- | Retrieves the FilePath’s parent directory.
parent :: FilePath -> FilePath

-- | Retrieve a FilePath’s filename component.
--   
--   
--   filename "foo/bar.txt" == "bar.txt"
--   
filename :: FilePath -> FilePath

-- | Retrieve a FilePath’s directory name. This is only the file
--   name of the directory, not its full path.
--   
--   
--   dirname "foo/bar/baz.txt" == "bar"
--   dirname "/" == ""
--   
--   
--   Since: 0.4.1
dirname :: FilePath -> FilePath

-- | Retrieve a FilePath’s basename component.
--   
--   
--   basename "foo/bar.txt" == "bar"
--   
basename :: FilePath -> FilePath

-- | Test whether a path is absolute.
absolute :: FilePath -> Bool

-- | Test whether a path is relative.
relative :: FilePath -> Bool

-- | Appends two FilePaths. If the second path is absolute, it is
--   returned unchanged.
append :: FilePath -> FilePath -> FilePath

-- | An alias for append.
(</>) :: FilePath -> FilePath -> FilePath

-- | A fold over append.
concat :: [FilePath] -> FilePath

-- | Find the greatest common prefix between a list of FilePaths.
commonPrefix :: [FilePath] -> FilePath

-- | Remove a prefix from a path.
--   
--   
--   stripPrefix "/foo/" "/foo/bar/baz.txt" == Just "bar/baz.txt"
--   stripPrefix "/foo/" "/bar/baz.txt" == Nothing
--   
--   
--   This function operates on logical prefixes, rather than by counting
--   characters. The prefix "/foo/bar/baz" is interpreted the path
--   ("/foo/bar/", "baz"), and will be stripped accordingly:
--   
--   
--   stripPrefix "/foo/bar/baz" "/foo/bar/baz/qux" == Nothing
--   stripPrefix "/foo/bar/baz" "/foo/bar/baz.txt" == Just ".txt"
--   
--   
--   Since: 0.4.1
stripPrefix :: FilePath -> FilePath -> Maybe FilePath

-- | Remove intermediate "." and ".." directories from a
--   path.
--   
--   
--   collapse "/foo/./bar" == "/foo/bar"
--   collapse "/foo/bar/../baz" == "/foo/baz"
--   collapse "/foo/../../bar" == "/bar"
--   collapse "./foo/bar" == "./foo/baz"
--   
--   
--   Note that if any of the elements are symbolic links, collapse
--   may change which file the path resolves to.
--   
--   Since: 0.2
collapse :: FilePath -> FilePath

-- | expand a FilePath into a list of the root name, directories, and file
--   name
--   
--   Since: 0.4.7
splitDirectories :: FilePath -> [FilePath]

-- | Get a FilePath’s last extension, or Nothing if it has no
--   extensions.
extension :: FilePath -> Maybe Text

-- | Get a FilePath’s full extension list.
extensions :: FilePath -> [Text]

-- | Get whether a FilePath’s last extension is the predicate.
hasExtension :: FilePath -> Text -> Bool

-- | Append an extension to the end of a FilePath.
addExtension :: FilePath -> Text -> FilePath

-- | An alias for addExtension.
(<.>) :: FilePath -> Text -> FilePath

-- | Remove a FilePath’s last extension.
dropExtension :: FilePath -> FilePath

-- | Replace a FilePath’s last extension.
replaceExtension :: FilePath -> Text -> FilePath

-- | Append many extensions to the end of a FilePath.
addExtensions :: FilePath -> [Text] -> FilePath

-- | Remove all extensions from a FilePath.
dropExtensions :: FilePath -> FilePath

-- | Remove all extensions from a FilePath, and replace them with a
--   new list.
replaceExtensions :: FilePath -> [Text] -> FilePath

-- | 
--   splitExtension p = (dropExtension p, extension p)
--   
splitExtension :: FilePath -> (FilePath, Maybe Text)

-- | 
--   splitExtensions p = (dropExtensions p, extensions p)
--   
splitExtensions :: FilePath -> (FilePath, [Text])
instance GHC.Internal.Base.Monoid Filesystem.Path.Internal.FilePath
instance GHC.Internal.Base.Semigroup Filesystem.Path.Internal.FilePath

module Filesystem.Path.Rules

-- | The type of platformFormat for Rules is conditionally
--   selected at compilation time. As such it is only intended for direct
--   use with external OS functions and code that expects
--   platformFormat to be stable across platforms may fail to
--   subsequently compile on a differing platform.
--   
--   For example: on Windows or OSX platformFormat will be
--   Text, and on Linux it will be ByteString.
--   
--   If portability is a concern, restrict usage to functions which do not
--   expose platformFormat directly.
data Rules platformFormat

-- | Linux, BSD, and other UNIX or UNIX-like operating systems.
posix :: Rules ByteString

-- | Linux, BSD, and other UNIX or UNIX-like operating systems.
--   
--   This is a variant of posix for use with GHC 7.2, which tries to
--   decode file paths in its IO computations.
--   
--   Since: 0.3.3 / 0.4.2
posix_ghc702 :: Rules ByteString

-- | Linux, BSD, and other UNIX or UNIX-like operating systems.
--   
--   This is a variant of posix for use with GHC 7.4 or later, which
--   tries to decode file paths in its IO computations.
--   
--   Since: 0.3.7 / 0.4.6
posix_ghc704 :: Rules ByteString

-- | Windows and DOS
windows :: Rules Text

-- | Darwin and Mac OS X.
--   
--   This is almost identical to posix, but with a native path type
--   of Text rather than ByteString.
--   
--   Since: 0.3.4 / 0.4.3
darwin :: Rules Text

-- | Darwin and Mac OS X.
--   
--   This is a variant of darwin for use with GHC 7.2 or later,
--   which tries to decode file paths in its IO computations.
--   
--   Since: 0.3.4 / 0.4.3
darwin_ghc702 :: Rules Text

-- | Attempt to convert a FilePath to human‐readable text.
--   
--   If the path is decoded successfully, the result is a Right
--   containing the decoded text. Successfully decoded text can be
--   converted back to the original path using fromText.
--   
--   If the path cannot be decoded, the result is a Left containing
--   an approximation of the original path. If displayed to the user, this
--   value should be accompanied by some warning that the path has an
--   invalid encoding. Approximated text cannot be converted back to the
--   original path.
--   
--   This function ignores the user’s locale, and assumes all file paths
--   are encoded in UTF8. If you need to display file paths with an unusual
--   or obscure encoding, use encode and then decode them manually.
--   
--   Since: 0.2
toText :: Rules platformFormat -> FilePath -> Either Text Text

-- | Convert human‐readable text into a FilePath.
--   
--   This function ignores the user’s locale, and assumes all file paths
--   are encoded in UTF8. If you need to create file paths with an unusual
--   or obscure encoding, encode them manually and then use decode.
--   
--   Since: 0.2
fromText :: Rules platformFormat -> Text -> FilePath

-- | Convert a FilePath to a platform‐specific format, suitable for
--   use with external OS functions.
--   
--   Note: The type of platformTextFormat can change depending
--   upon the underlying compilation platform. Consider using toText
--   or encodeString instead. See Rules for more information.
--   
--   Since: 0.3
encode :: Rules platformFormat -> FilePath -> platformFormat

-- | Convert a FilePath from a platform‐specific format, suitable
--   for use with external OS functions.
--   
--   Note: The type of platformTextFormat can change depending
--   upon the underlying compilation platform. Consider using
--   fromText or decodeString instead. See Rules for
--   more information.
--   
--   Since: 0.3
decode :: Rules platformFormat -> platformFormat -> FilePath

-- | Attempt to convert a FilePath to a string suitable for use with
--   functions in System.IO. The contents of this string are
--   platform‐dependent, and are not guaranteed to be human‐readable. For
--   converting FilePaths to a human‐readable format, use
--   toText.
--   
--   Since: 0.3.1
encodeString :: Rules platformFormat -> FilePath -> String

-- | Attempt to parse a FilePath from a string suitable for use with
--   functions in System.IO. Do not use this function for parsing
--   human‐readable paths, as the character set decoding is
--   platform‐dependent. For converting human‐readable text to a
--   FilePath, use fromText.
--   
--   Since: 0.3.1
decodeString :: Rules platformFormat -> String -> FilePath

-- | Check if a FilePath is valid; it must not contain any illegal
--   characters, and must have a root appropriate to the current
--   Rules.
valid :: Rules platformFormat -> FilePath -> Bool

-- | Split a search path, such as $PATH or $PYTHONPATH,
--   into a list of FilePaths.
--   
--   Note: The type of platformTextFormat can change depending
--   upon the underlying compilation platform. Consider using
--   splitSearchPathString instead. See Rules for more
--   information.
splitSearchPath :: Rules platformFormat -> platformFormat -> [FilePath]

-- | splitSearchPathString is like splitSearchPath, but takes a
--   string encoded in the format used by System.IO.
splitSearchPathString :: Rules platformFormat -> String -> [FilePath]

-- | Re‐exports contents of Filesystem.Path.Rules, defaulting to the
--   current OS’s rules when needed.
--   
--   Also enables Show and IsString instances for
--   FilePath.
module Filesystem.Path.CurrentOS
currentOS :: Rules platformTextFormat

-- | Attempt to convert a FilePath to human‐readable text.
--   
--   If the path is decoded successfully, the result is a Right
--   containing the decoded text. Successfully decoded text can be
--   converted back to the original path using fromText.
--   
--   If the path cannot be decoded, the result is a Left containing
--   an approximation of the original path. If displayed to the user, this
--   value should be accompanied by some warning that the path has an
--   invalid encoding. Approximated text cannot be converted back to the
--   original path.
--   
--   This function ignores the user’s locale, and assumes all file paths
--   are encoded in UTF8. If you need to display file paths with an unusual
--   or obscure encoding, use encode and then decode them manually.
--   
--   Since: 0.2
toText :: FilePath -> Either Text Text

-- | Convert human‐readable text into a FilePath.
--   
--   This function ignores the user’s locale, and assumes all file paths
--   are encoded in UTF8. If you need to create file paths with an unusual
--   or obscure encoding, encode them manually and then use decode.
--   
--   Since: 0.2
fromText :: Text -> FilePath

-- | Convert a FilePath to a platform‐specific format, suitable for
--   use with external OS functions.
--   
--   Note: The type platformTextFormat can change depending upon
--   the underlying compilation platform. Consider using toText or
--   encodeString instead. See Rules for more information.
--   
--   Since: 0.3
encode :: FilePath -> platformTextFormat

-- | Convert a FilePath from a platform‐specific format, suitable
--   for use with external OS functions.
--   
--   Note: The type platformTextFormat can change depending upon
--   the underlying compilation platform. Consider using fromText or
--   decodeString instead. See Rules for more information.
--   
--   Since: 0.3
decode :: platformTextFormat -> FilePath

-- | Attempt to convert a FilePath to a string suitable for use with
--   functions in System.IO. The contents of this string are
--   platform‐dependent, and are not guaranteed to be human‐readable. For
--   converting FilePaths to a human‐readable format, use
--   toText.
--   
--   Since: 0.3.1
encodeString :: FilePath -> String

-- | Attempt to parse a FilePath from a string suitable for use with
--   functions in System.IO. Do not use this function for parsing
--   human‐readable paths, as the character set decoding is
--   platform‐dependent. For converting human‐readable text to a
--   FilePath, use fromText.
--   
--   Since: 0.3.1
decodeString :: String -> FilePath

-- | Check if a FilePath is valid; it must not contain any illegal
--   characters, and must have a root appropriate to the current
--   Rules.
valid :: FilePath -> Bool

-- | Split a search path, such as $PATH or $PYTHONPATH,
--   into a list of FilePaths.
splitSearchPath :: platformTextFormat -> [FilePath]

-- | splitSearchPathString is like splitSearchPath, but takes a
--   string encoded in the format used by System.IO.
splitSearchPathString :: String -> [FilePath]
instance GHC.Internal.Data.String.IsString Filesystem.Path.Internal.FilePath
instance GHC.Internal.Show.Show Filesystem.Path.Internal.FilePath
