-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | High-level, byte-based file and directory path manipulations -- -- High-level, byte-based file and directory path manipulations @package system-filepath @version 0.2 -- | High‐level, byte‐based file and directory path manipulations. You -- probably want to import System.FilePath.CurrentOS instead, -- since it handles detecting which rules to use in the current -- compilation. module System.FilePath 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 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 "." and ".." directories from a path. -- -- 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 -- | Get a FilePath’s last extension, or Nothing if it has no -- extensions. extension :: FilePath -> Maybe ByteString -- | Get a FilePath’s full extension list. extensions :: FilePath -> [ByteString] -- | Get whether a FilePath’s last extension is the predicate. hasExtension :: FilePath -> ByteString -> Bool -- | Append an extension to the end of a FilePath. addExtension :: FilePath -> ByteString -> FilePath -- | An alias for addExtension. (<.>) :: FilePath -> ByteString -> FilePath -- | Remove a FilePath’s last extension. dropExtension :: FilePath -> FilePath -- | Replace a FilePath’s last extension. replaceExtension :: FilePath -> ByteString -> FilePath -- | Append many extensions to the end of a FilePath. addExtensions :: FilePath -> [ByteString] -> 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 -> [ByteString] -> FilePath -- |
--   splitExtension p = (dropExtension p, extension p)
--   
splitExtension :: FilePath -> (FilePath, Maybe ByteString) -- |
--   splitExtensions p = (dropExtensions p, extensions p)
--   
splitExtensions :: FilePath -> (FilePath, [ByteString]) instance Monoid FilePath module System.FilePath.Rules data Rules -- | Linux, BSD, OS X, and other UNIX or UNIX-like operating systems. posix :: Rules -- | Windows and DOS windows :: Rules -- | Convert a FilePath into a strict ByteString, suitable -- for passing to OS libraries. toBytes :: Rules -> FilePath -> ByteString -- | Parse a strict ByteString, such as those received from OS -- libraries, into a FilePath. fromBytes :: Rules -> ByteString -> FilePath -- | 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 toBytes and then decode them manually. -- -- Since: 0.2 toText :: Rules -> 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 -- fromBytes. -- -- Since: 0.2 fromText :: Rules -> Text -> 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 -> FilePath -> Bool -- | Split a search path, such as $PATH or $PYTHONPATH, -- into a list of FilePaths. splitSearchPath :: Rules -> ByteString -> [FilePath] -- | Re‐exports contents of System.FilePath.Rules, defaulting to the -- current OS’s rules when needed. -- -- Also enables Show and IsString instances for -- FilePath. module System.FilePath.CurrentOS currentOS :: Rules -- | Convert a FilePath into a strict ByteString, suitable -- for passing to OS libraries. toBytes :: FilePath -> ByteString -- | Parse a strict ByteString, such as those received from OS -- libraries, into a FilePath. fromBytes :: ByteString -> FilePath -- | 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 toBytes 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 -- fromBytes. -- -- Since: 0.2 fromText :: Text -> 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 :: ByteString -> [FilePath] instance Show FilePath instance IsString FilePath