-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Path -- -- Path @package path @version 0.5.2 -- | Internal types and functions. module Path.Internal -- | Path of some base and type. -- -- Internally is a string. The string can be of two formats only: -- --
-- $(mkAbsDir x) </> $(mkRelDir y) = $(mkAbsDir (x ++ "/" ++ y)) ---- --
-- $(mkAbsDir x) </> $(mkRelFile y) = $(mkAbsFile (x ++ "/" ++ y)) ---- --
-- $(mkRelDir x) </> $(mkRelDir y) = $(mkRelDir (x ++ "/" ++ y)) ---- --
-- $(mkRelDir x) </> $(mkRelFile y) = $(mkRelFile (x ++ "/" ++ y)) ---- -- The following are proven not possible to express: -- --
-- $(mkAbsFile …) </> x ---- --
-- $(mkRelFile …) </> x ---- --
-- x </> $(mkAbsFile …) ---- --
-- x </> $(mkAbsDir …) --(>) :: Path b Dir -> Path Rel t -> Path b t -- | Strip directory from path, making it relative to that directory. -- Returns Nothing if directory is not a parent of the path. -- -- The following properties hold: -- --
-- stripDir x (x </> y) = y ---- -- Cases which are proven not possible: -- --
-- stripDir (a :: Path Abs …) (b :: Path Rel …) ---- --
-- stripDir (a :: Path Rel …) (b :: Path Abs …) ---- -- In other words the bases must match. -- -- Throws: Couldn'tStripPrefixDir stripDir :: MonadThrow m => Path b Dir -> Path b t -> m (Path Rel t) -- | Is p a parent of the given location? Implemented in terms of -- stripDir. The bases must match. isParentOf :: Path b Dir -> Path b t -> Bool -- | Take the absolute parent directory from the absolute path. -- -- The following properties hold: -- --
-- parent (x </> y) == x ---- -- On the root, getting the parent is idempotent: -- --
-- parent (parent "/") = "/" --parent :: Path Abs t -> Path Abs Dir -- | Extract the file part of a path. -- -- The following properties hold: -- --
-- filename (p </> a) == filename a --filename :: Path b File -> Path Rel File -- | Extract the last directory name of a path. -- -- The following properties hold: -- --
-- dirname (p </> a) == dirname a --dirname :: Path b Dir -> Path Rel Dir -- | Convert to a FilePath type. -- -- All directories have a trailing slash, so if you want no trailing -- slash, you can use dropTrailingPathSeparator from the filepath -- package. toFilePath :: Path b t -> FilePath instance GHC.Show.Show Path.PathParseException instance GHC.Exception.Exception Path.PathParseException