-- 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.1.1 -- | 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, components, 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 the filename component of a FilePath. filename -- "foo/bar.txt" == "bar.txt". filename :: FilePath -> FilePath -- | Retrieve the basename component of a FilePath. filename -- "foo/bar.txt" == "bar". basename :: FilePath -> FilePath -- | Return whether the path is absolute. absolute :: FilePath -> Bool -- | Return whether the 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 two FilePaths. commonPrefix :: [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 posix :: Rules windows :: Rules -- | Check if a FilePath is valid; that is, it must not contain any -- illegal characters, and must have a root appropriate to the current -- Rules. valid :: Rules -> FilePath -> Bool -- | Remove redundant characters. On case-insensitive platforms, also -- lowercases any ASCII uppercase characters. normalise :: Rules -> FilePath -> FilePath -- | Check if two different FilePaths refer to the same file. This -- does not perform any link resolution, so some equivalent files might -- be missed. equivalent :: Rules -> FilePath -> FilePath -> Bool -- | Convert a FilePath into a strict ByteString, suitable -- for passing to OS libraries. toBytes :: Rules -> FilePath -> ByteString -- | Convert a FilePath into a lazy ByteString. toLazyBytes :: Rules -> FilePath -> ByteString -- | Convert a FilePath into a lazy String. This is useful -- for interoperating with legacy libraries. No decoding is performed; -- the string's character ordinals are equal to the path's original -- bytes. If you need to display a FilePath to the user, use -- toLazyBytes and an appropriate decoding function. toString :: Rules -> FilePath -> String -- | Parse a strict ByteString, such as those received from OS -- libraries, into a FilePath. fromBytes :: Rules -> ByteString -> FilePath -- | Parse a lazy ByteString into a FilePath. fromLazyBytes :: Rules -> ByteString -> FilePath -- | Parse a lazy String into a FilePath. This is useful for -- interoperating with legacy libraries. No encoding is performed; -- characters are truncated to 8 bits. If you need to accept a -- FilePath from the user, use fromLazyBytes and an -- appropriate encoding function. fromString :: Rules -> String -> FilePath -- | 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 -- | See valid valid :: FilePath -> Bool -- | See normalise normalise :: FilePath -> FilePath -- | See equivalent equivalent :: FilePath -> FilePath -> Bool -- | See toBytes toBytes :: FilePath -> ByteString -- | See toLazyBytes toLazyBytes :: FilePath -> ByteString -- | See toString toString :: FilePath -> String -- | See fromBytes fromBytes :: ByteString -> FilePath -- | See fromLazyBytes fromLazyBytes :: ByteString -> FilePath -- | See fromString fromString :: String -> FilePath -- | See splitSearchPath splitSearchPath :: ByteString -> [FilePath] instance Show FilePath instance IsString FilePath