-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Safe Paths in Haskell -- -- Please see README.md @package safepath @version 0.1.0.0 module Data.Path.Internal type AbsPath = Path Absolute type RelPath = Path Relative data Path rel Path :: [PathPiece] -> LastPathPiece -> [Extension] -> Path rel [pathPieces] :: Path rel -> [PathPiece] [pathLastPiece] :: Path rel -> LastPathPiece [pathExtensions] :: Path rel -> [Extension] data Absolute Absolute :: Absolute data Relative Relative :: Relative -- | ONLY for OverloadedStrings This instance instance is unsafe -- and should only be used at own risk, for literals -- | ONLY for OverloadedStrings This instance instance is unsafe -- and should only be used at own risk, for literals newtype PathPiece PathPiece :: Text -> PathPiece -- | ONLY for OverloadedStrings This instance instance is unsafe -- and should only be used at own risk, for literals newtype LastPathPiece LastPathPiece :: Text -> LastPathPiece -- | ONLY for OverloadedStrings This instance instance is unsafe -- and should only be used at own risk, for literals newtype Extension Extension :: Text -> Extension -- | ONLY for OverloadedStrings This instance instance is unsafe -- and should only be used at own risk, for literals pathSeparator :: Char pathSeparators :: [Char] -- | Check if a given character is a valid path separator -- --
--   >>> isPathSeparator pathSeparator
--   True
--   
--   >>> all isPathSeparator pathSeparators
--   True
--   
isPathSeparator :: Char -> Bool extensionSeparator :: Char extensionSeparators :: [Char] -- | Check if a given character is a valid extension separator -- --
--   >>> isExtensionSeparator extensionSeparator
--   True
--   
--   >>> all isExtensionSeparator extensionSeparators
--   True
--   
isExtensionSeparator :: Char -> Bool containsSatisfied :: (Char -> Bool) -> Text -> Bool containsSeparator :: Text -> Bool containsExtension :: Text -> Bool -- | Construct a relative path from a FilePath, failing if the given -- FilePath does not represent a valid relative path. -- --
--   >>> relpath "file"
--   Just file
--   
--   >>> relpath "/file"
--   Nothing
--   
--   >>> relpath "."
--   Just .
--   
--   >>> relpath "/"
--   Nothing
--   
--   >>> relpath ""
--   Nothing
--   
relpath :: FilePath -> Maybe RelPath -- | Construct an absolute path from a FilePath, failing if the -- given FilePath does not represent a valid absolute path. -- --
--   >>> abspath "/file"
--   Just /file
--   
--   >>> abspath "file"
--   Nothing
--   
--   >>> abspath "/"
--   Just /
--   
--   >>> abspath "."
--   Nothing
--   
--   >>> abspath ""
--   Nothing
--   
abspath :: FilePath -> Maybe AbsPath -- | Construct a path piece safely -- --
--   >>> pathpiece "file"
--   Just file
--   
--   >>> pathpiece "with.dot"
--   Just with.dot
--   
--   >>> pathpiece "with/slash"
--   Nothing
--   
pathpiece :: String -> Maybe PathPiece -- | Construct a last path piece safely -- --
--   >>> lastpiece "file"
--   Just file
--   
--   >>> lastpiece "with.dot"
--   Nothing
--   
lastpiece :: String -> Maybe LastPathPiece -- | Construct an extension safely -- --
--   >>> ext "extension"
--   Just extension
--   
--   >>> ext ".ext"
--   Nothing
--   
--   >>> ext ""
--   Nothing
--   
ext :: String -> Maybe Extension -- | Ground a filepath on an absolute path. This will try to parse the -- given FilePath as an absolute path and take it if that works. -- Otherwise it will try to parse it an a relative path and append it to -- the given AbsPath -- --
--   >>> ground "/home/user" "relative/path"
--   Just /home/user/relative/path
--   
--   >>> ground "/home/user" "/absolute/path"
--   Just /absolute/path
--   
--   >>> ground "/home/user" "."
--   Just /home/user
--   
--   >>> ground "/home/user" "/"
--   Just /
--   
--   >>> ground "/" "."
--   Just /
--   
--   >>> ground "/anything" ""
--   Nothing
--   
ground :: AbsPath -> FilePath -> Maybe AbsPath -- | Construct a relative path, throwing an error if relpath -- would fail. unsafeRelPathError :: FilePath -> RelPath -- | Construct an absolute path, throwing an error if abspath -- would fail. unsafeAbsPathError :: FilePath -> AbsPath -- | Construct an extension, throwing an error if pathpiece -- would fail. unsafePathPieceError :: String -> PathPiece -- | Construct an extension, throwing an error if lastpiece -- would fail. unsafeLastPieceError :: String -> LastPathPiece -- | Construct an extension, throwing an error if ext would -- fail. unsafeExtError :: String -> Extension -- | Render a relative filepath to a FilePath toRelFilePath :: RelPath -> FilePath -- | Render an absolute filepath to a FilePath toAbsFilePath :: AbsPath -> FilePath -- | Take the last extension of a filepath -- --
--   >>> takeExtension ("/directory/path.ext" :: AbsPath)
--   Just ext
--   
--   >>> takeExtension ("file.tar.gz" :: RelPath)
--   Just gz
--   
--   >>> takeExtension ("file" :: RelPath)
--   Nothing
--   
-- -- Replaces System.FilePath.takeExtension takeExtension :: Path rel -> Maybe Extension -- | Take all extensions of a given path in the form of a list -- --
--   >>> takeExtensions ("/directory/path.ext" :: AbsPath)
--   [ext]
--   
--   >>> takeExtensions ("file.tar.gz" :: RelPath)
--   [tar,gz]
--   
-- -- Replaces System.FilePath.takeExtensions takeExtensions :: Path rel -> [Extension] -- | Replace the last extension of a path, exactly -- -- This will fail if the given path has no extension -- --
--   >>> replaceExtensionExact "dir/file.ext1.ext2"  "ext3" :: Maybe RelPath
--   Just dir/file.ext1.ext3
--   
--   >>> replaceExtensionExact "dir/file.ext1"       "ext2" :: Maybe RelPath
--   Just dir/file.ext2
--   
--   >>> replaceExtensionExact "dir/file"            "ext"  :: Maybe RelPath
--   Nothing
--   
--   >>> replaceExtensionExact "/dir/file.ext1.ext2" "ext3" :: Maybe AbsPath
--   Just /dir/file.ext1.ext3
--   
--   >>> replaceExtensionExact "/dir/file.ext1"      "ext2" :: Maybe AbsPath
--   Just /dir/file.ext2
--   
--   >>> replaceExtensionExact "/dir/file"           "ext"  :: Maybe AbsPath
--   Nothing
--   
--   >>> replaceExtensionExact "." "ext" :: Maybe RelPath
--   Nothing
--   
--   >>> replaceExtensionExact "/" "ext" :: Maybe AbsPath
--   Nothing
--   
replaceExtensionExact :: Path rel -> Extension -> Maybe (Path rel) -- | Replace the last extension of a path -- -- This will first remove one extension and then add the given extension. -- --
--   replaceExtension path extension = dropExtension path <.> extension
--   
-- --
--   >>> replaceExtension "dir/file.ext1.ext2"  "ext3" :: RelPath
--   dir/file.ext1.ext3
--   
--   >>> replaceExtension "dir/file.ext1"       "ext2" :: RelPath
--   dir/file.ext2
--   
--   >>> replaceExtension "dir/file"            "ext"  :: RelPath
--   dir/file.ext
--   
--   >>> replaceExtension "/dir/file.ext1.ext2" "ext3" :: AbsPath
--   /dir/file.ext1.ext3
--   
--   >>> replaceExtension "/dir/file.ext1"      "ext2" :: AbsPath
--   /dir/file.ext2
--   
--   >>> replaceExtension "/dir/file"           "ext"  :: AbsPath
--   /dir/file.ext
--   
--   >>> replaceExtension "." "ext" :: RelPath
--   .
--   
--   >>> replaceExtension "/" "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.replaceExtension replaceExtension :: Path rel -> Extension -> Path rel -- | Replace the last extension of a path (equivalent to -- replaceExtension) -- --
--   >>> "dir/file.ext1.ext2" -<.> "ext3"   :: RelPath
--   dir/file.ext1.ext3
--   
--   >>> "dir/file.ext1" -<.> "ext2"        :: RelPath
--   dir/file.ext2
--   
--   >>> "dir/file" -<.> "ext"              :: RelPath
--   dir/file.ext
--   
--   >>> "/dir/file.ext1.ext2" -<.> "ext3"  :: AbsPath
--   /dir/file.ext1.ext3
--   
--   >>> "/dir/file.ext1" -<.> "ext2"       :: AbsPath
--   /dir/file.ext2
--   
--   >>> "/dir/file" -<.> "ext"             :: AbsPath
--   /dir/file.ext
--   
--   >>> "." -<.> "ext" :: RelPath
--   .
--   
--   >>> "/" -<.> "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.(-.) (-<.>) :: Path rel -> Extension -> Path rel -- | Replace all the extensions of a path with the given extension -- --
--   >>> replaceExtensions "dir/file.ext1.ext2"  "ext3" :: RelPath
--   dir/file.ext3
--   
--   >>> replaceExtensions "dir/file.ext1"       "ext3" :: RelPath
--   dir/file.ext3
--   
--   >>> replaceExtensions "dir/file"            "ext3" :: RelPath
--   dir/file.ext3
--   
--   >>> replaceExtensions "/dir/file.ext1.ext2" "ext3" :: AbsPath
--   /dir/file.ext3
--   
--   >>> replaceExtensions "/dir/file.ext1"      "ext3" :: AbsPath
--   /dir/file.ext3
--   
--   >>> replaceExtensions "/dir/file"           "ext3" :: AbsPath
--   /dir/file.ext3
--   
--   >>> replaceExtensions "." "ext" :: RelPath
--   .
--   
--   >>> replaceExtensions "/" "ext" :: AbsPath
--   /
--   
replaceExtensions :: Path rel -> Extension -> Path rel -- | Replace all the extensions of a path with the given list of extensions -- --
--   >>> replaceExtensionss "dir/file.ext1.ext2"  ["ext3", "ext4"] :: RelPath
--   dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "dir/file.ext1"       ["ext3", "ext4"] :: RelPath
--   dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "dir/file"            ["ext3", "ext4"] :: RelPath
--   dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "/dir/file.ext1.ext2" ["ext3", "ext4"] :: AbsPath
--   /dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "/dir/file.ext1"      ["ext3", "ext4"] :: AbsPath
--   /dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "/dir/file"           ["ext3", "ext4"] :: AbsPath
--   /dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "." ["ext1", "ext2"] :: RelPath
--   .
--   
--   >>> replaceExtensionss "/" ["ext1", "ext2"] :: AbsPath
--   /
--   
replaceExtensionss :: Path rel -> [Extension] -> Path rel -- | Drop the last extension of a path, exactly -- -- This will fail if the given path has no extensions -- --
--   >>> dropExtensionExact "dir/file.ext1.ext2" :: Maybe RelPath
--   Just dir/file.ext1
--   
--   >>> dropExtensionExact "dir/file.ext" :: Maybe RelPath
--   Just dir/file
--   
--   >>> dropExtensionExact "dir/file" :: Maybe RelPath
--   Nothing
--   
--   >>> dropExtensionExact "/dir/file.ext1.ext2" :: Maybe AbsPath
--   Just /dir/file.ext1
--   
--   >>> dropExtensionExact "/dir/file.ext" :: Maybe AbsPath
--   Just /dir/file
--   
--   >>> dropExtensionExact "/dir/file" :: Maybe AbsPath
--   Nothing
--   
--   >>> dropExtensionExact "." :: Maybe RelPath
--   Nothing
--   
--   >>> dropExtensionExact "/" :: Maybe AbsPath
--   Nothing
--   
dropExtensionExact :: Path rel -> Maybe (Path rel) -- | Drop the last extension of a path -- --
--   >>> dropExtension "dir/file.ext1.ext2" :: RelPath
--   dir/file.ext1
--   
--   >>> dropExtension "dir/file.ext" :: RelPath
--   dir/file
--   
--   >>> dropExtension "dir/file" :: RelPath
--   dir/file
--   
--   >>> dropExtension "/dir/file.ext1.ext2" :: AbsPath
--   /dir/file.ext1
--   
--   >>> dropExtension "/dir/file.ext" :: AbsPath
--   /dir/file
--   
--   >>> dropExtension "/dir/file" :: AbsPath
--   /dir/file
--   
--   >>> dropExtension "." :: RelPath
--   .
--   
--   >>> dropExtension "/" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.dropExtension dropExtension :: Path rel -> Path rel -- | Drop all extensions of a path -- --
--   >>> dropExtensions "dir/file.ext1.ext2" :: RelPath
--   dir/file
--   
--   >>> dropExtensions "dir/file.ext" :: RelPath
--   dir/file
--   
--   >>> dropExtensions "dir/file" :: RelPath
--   dir/file
--   
--   >>> dropExtensions "/dir/file.ext1.ext2" :: AbsPath
--   /dir/file
--   
--   >>> dropExtensions "/dir/file.ext" :: AbsPath
--   /dir/file
--   
--   >>> dropExtensions "/dir/file" :: AbsPath
--   /dir/file
--   
--   >>> dropExtensions "." :: RelPath
--   .
--   
--   >>> dropExtensions "/" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.dropExtensions dropExtensions :: Path rel -> Path rel -- | Add an extension to a path -- --
--   >>> addExtension "/directory/path" "ext" :: AbsPath
--   /directory/path.ext
--   
--   >>> addExtension "directory/path"  "ext" :: RelPath
--   directory/path.ext
--   
-- -- This will not override the extension if there already is an extension. -- It will only add the given extension on top of it -- --
--   >>> addExtension "/directory/path.ext1" "ext2" :: AbsPath
--   /directory/path.ext1.ext2
--   
--   >>> addExtension "directory/path.ext1"  "ext2" :: RelPath
--   directory/path.ext1.ext2
--   
-- -- This will not add an extension if the path is empty. -- --
--   >>> addExtension "." "ext" :: RelPath
--   .
--   
--   >>> addExtension "/" "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.addExtension addExtension :: Path rel -> Extension -> Path rel -- | Add an extension to a path (equivalent to addExtension) -- --
--   >>> "/directory/path" <.> "ext" :: AbsPath
--   /directory/path.ext
--   
--   >>> "directory/path"  <.> "ext" :: RelPath
--   directory/path.ext
--   
--   >>> "/directory/path.ext1" <.> "ext2" :: AbsPath
--   /directory/path.ext1.ext2
--   
--   >>> "directory/path.ext1"  <.> "ext2" :: RelPath
--   directory/path.ext1.ext2
--   
--   >>> "." <.> "ext" :: RelPath
--   .
--   
--   >>> "/" <.> "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.(.) (<.>) :: Path rel -> Extension -> Path rel -- | Add a list of extensions to a path -- --
--   >>> addExtensions "/directory/path" ["ext1", "ext2"] :: AbsPath
--   /directory/path.ext1.ext2
--   
--   >>> addExtensions "directory/path"  ["ext1", "ext2"] :: RelPath
--   directory/path.ext1.ext2
--   
-- --
--   >>> addExtensions "/directory/path.ext1" ["ext2", "ext3"] :: AbsPath
--   /directory/path.ext1.ext2.ext3
--   
--   >>> addExtensions "directory/path.ext1"  ["ext2", "ext3"] :: RelPath
--   directory/path.ext1.ext2.ext3
--   
-- --
--   >>> addExtensions "." ["ext1", "ext2"] :: RelPath
--   .
--   
--   >>> addExtensions "/" ["ext1", "ext2"] :: AbsPath
--   /
--   
-- -- This operation is an identity function if the given list of extensions -- is empty. addExtensions :: Path rel -> [Extension] -> Path rel -- | Drop the given extension from a FilePath. Fails if the FilePath does -- not have the given extension. -- --
--   >>> stripExtension "foo.x.hs.o" "o"    :: Maybe RelPath
--   Just foo.x.hs
--   
--   >>> stripExtension "foo.x.hs.o" "hs"   :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtension "a.b.c.d"    "d"    :: Maybe RelPath
--   Just a.b.c
--   
--   >>> stripExtension "foo.bar"    "baz"  :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtension "foobar"     "bar"  :: Maybe RelPath
--   Nothing
--   
-- -- Replaces System.FilePath.stripExtension stripExtension :: Path rel -> Extension -> Maybe (Path rel) -- | Drop the given extensions from a FilePath. Fails if the FilePath does -- not have all of the given extensions. -- --
--   >>> stripExtensions "foo.x.hs.o" ["hs", "o"]      :: Maybe RelPath
--   Just foo.x
--   
--   >>> stripExtensions "foo.x.hs.o" ["o", "hs"]      :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtensions "a.b.c.d"    ["c", "d"]       :: Maybe RelPath
--   Just a.b
--   
--   >>> stripExtensions "foo.bar"    ["baz", "quux"]  :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtensions "foobar"     ["bar"]          :: Maybe RelPath
--   Nothing
--   
stripExtensions :: Path rel -> [Extension] -> Maybe (Path rel) -- | Split off the extensions from a path -- --
--   >>> splitExtension ("dir/file.ext1.ext2" :: RelPath)
--   Just (dir/file.ext1,ext2)
--   
--   >>> splitExtension ("dir/file.ext" :: RelPath)
--   Just (dir/file,ext)
--   
--   >>> splitExtension ("dir/file" :: RelPath)
--   Nothing
--   
--   >>> splitExtension ("/dir/file.ext1.ext2" :: AbsPath)
--   Just (/dir/file.ext1,ext2)
--   
--   >>> splitExtension ("/dir/file.ext" :: AbsPath)
--   Just (/dir/file,ext)
--   
--   >>> splitExtension ("/dir/file" :: AbsPath)
--   Nothing
--   
--   >>> splitExtension ("." :: RelPath)
--   Nothing
--   
--   >>> splitExtension ("/" :: AbsPath)
--   Nothing
--   
-- -- Replaces System.FilePath.splitExtension splitExtension :: Path rel -> Maybe (Path rel, Extension) -- | Split off the extensions from a path -- --
--   >>> splitExtensions ("dir/file.ext1.ext2" :: RelPath)
--   (dir/file,[ext1,ext2])
--   
--   >>> splitExtensions ("dir/file.ext" :: RelPath)
--   (dir/file,[ext])
--   
--   >>> splitExtensions ("dir/file" :: RelPath)
--   (dir/file,[])
--   
--   >>> splitExtensions ("/dir/file.ext1.ext2" :: AbsPath)
--   (/dir/file,[ext1,ext2])
--   
--   >>> splitExtensions ("/dir/file.ext" :: AbsPath)
--   (/dir/file,[ext])
--   
--   >>> splitExtensions ("/dir/file" :: AbsPath)
--   (/dir/file,[])
--   
--   >>> splitExtensions ("." :: RelPath)
--   (.,[])
--   
--   >>> splitExtensions ("/" :: AbsPath)
--   (/,[])
--   
splitExtensions :: Path rel -> (Path rel, [Extension]) -- | Check whether the given filepath has any extensions -- --
--   >>> hasExtension ("/directory/path.ext" :: AbsPath)
--   True
--   
--   >>> hasExtension ("/directory/path"     :: AbsPath)
--   False
--   
-- -- Replaces System.FilePath.hasExtension hasExtension :: Path rel -> Bool -- | Split a path into all but the last piece and the last piece and the -- extensions -- --
--   >>> splitFileName ("/directory/file.ext" :: AbsPath)
--   (/directory,file.ext)
--   
--   >>> splitFileName ("file/bob.txt" :: RelPath)
--   (file,bob.txt)
--   
--   >>> splitFileName ("file" :: RelPath)
--   (.,file)
--   
--   >>> splitFileName ("dir.ext/file.ext" :: RelPath)
--   (dir.ext,file.ext)
--   
splitFileName :: Path rel -> (Path rel, RelPath) -- | Take the last piece and the extensions, exactly. -- -- This will evaluate to Nothing if the given path is empty -- --
--   >>> takeFileNameExact ("/directory/file.ext" :: AbsPath)
--   Just file.ext
--   
--   >>> takeFileNameExact ("file/bob.txt" :: RelPath)
--   Just bob.txt
--   
--   >>> takeFileNameExact ("file" :: RelPath)
--   Just file
--   
--   >>> takeFileNameExact ("dir.ext/file.ext" :: RelPath)
--   Just file.ext
--   
--   >>> takeFileNameExact ("." :: RelPath)
--   Nothing
--   
--   >>> takeFileNameExact ("/" :: AbsPath)
--   Nothing
--   
-- -- Replaces System.FilePath.takeFileName takeFileNameExact :: Path rel -> Maybe RelPath -- | Take the last piece and the extensions. -- -- This will evaluate to the empty (relative) path if the given path is -- empty. -- --
--   >>> takeFileName ("/directory/file.ext" :: AbsPath)
--   file.ext
--   
--   >>> takeFileName ("file/bob.txt" :: RelPath)
--   bob.txt
--   
--   >>> takeFileName ("file" :: RelPath)
--   file
--   
--   >>> takeFileName ("dir.ext/file.ext" :: RelPath)
--   file.ext
--   
--   >>> takeFileName ("." :: RelPath)
--   .
--   
--   >>> takeFileName ("/" :: AbsPath)
--   .
--   
-- -- Replaces System.FilePath.takeFileName takeFileName :: Path rel -> RelPath -- | Replace the last piece of a path with the given last piece. -- --
--   >>> replaceFileNameExact "/directory/other.txt" "file.ext" :: Maybe AbsPath
--   Just /directory/file.ext
--   
--   >>> replaceFileNameExact "." "file.ext" :: Maybe RelPath
--   Just file.ext
--   
--   >>> replaceFileNameExact "/" "file.ext" :: Maybe AbsPath
--   Just /file.ext
--   
-- -- If the given path piece is degenerate, this is what happens: -- --
--   >>> replaceFileNameExact "/directory/other.txt" "..." :: Maybe AbsPath
--   Nothing
--   
replaceFileNameExact :: Path rel -> PathPiece -> Maybe (Path rel) -- | Replace the last piece of a path with the given last piece. -- --
--   >>> replaceFileName "/directory/other.txt" "file.ext" :: AbsPath
--   /directory/file.ext
--   
--   >>> replaceFileName "." "file.ext" :: RelPath
--   file.ext
--   
--   >>> replaceFileName "/" "file.ext" :: AbsPath
--   /file.ext
--   
-- -- If the given path piece is degenerate, this is what happens: -- --
--   >>> replaceFileName "/directory/other.txt" "..." :: AbsPath
--   /directory
--   
replaceFileName :: Path rel -> PathPiece -> Path rel -- | Drop the last piece of a path, exactly -- --
--   >>> dropFileNameExact ("directory/file.ext" :: RelPath)
--   Just directory
--   
--   >>> dropFileNameExact ("/directory/file.ext" :: AbsPath)
--   Just /directory
--   
-- -- This evaluates to Nothing when given an empty path -- --
--   >>> dropFileNameExact ("/" :: AbsPath)
--   Nothing
--   
--   >>> dropFileNameExact ("." :: RelPath)
--   Nothing
--   
dropFileNameExact :: Path rel -> Maybe (Path rel) -- | Drop the last piece of a path -- --
--   >>> dropFileName ("directory/file.ext" :: RelPath)
--   directory
--   
--   >>> dropFileName ("/directory/file.ext" :: AbsPath)
--   /directory
--   
-- -- This evaluates to an empty path when given an empty path -- --
--   >>> dropFileName ("/" :: AbsPath)
--   /
--   
--   >>> dropFileName ("." :: RelPath)
--   .
--   
-- -- Replaces System.FilePath.dropFileName and -- System.FilePath.takeDirectory dropFileName :: Path rel -> Path rel -- | Take the last piece (no extensions) -- --
--   >>> takeBaseNameExact ("file.ext" :: RelPath)
--   Just file
--   
--   >>> takeBaseNameExact ("dir/and/file.ext" :: RelPath)
--   Just file
--   
-- -- This will evaluate to Nothing when given an empty path: -- --
--   >>> takeBaseNameExact ("." :: RelPath)
--   Nothing
--   
--   >>> takeBaseNameExact ("/" :: AbsPath)
--   Nothing
--   
takeBaseNameExact :: Path rel -> Maybe LastPathPiece -- | Take the last piece (no extensions) -- --
--   >>> takeBaseName ("file.ext" :: RelPath)
--   file
--   
--   >>> takeBaseName ("dir/and/file.ext" :: RelPath)
--   file
--   
-- -- This will evaluate to an empty last path piece when given an empty -- path: -- -- Replaces System.FilePath.takeBaseName takeBaseName :: Path rel -> LastPathPiece -- | Replace the last piece exactly: fails on empty last piece -- --
--   >>> replaceBaseNameExact "file.ext" "piece" :: Maybe RelPath
--   Just piece.ext
--   
--   >>> replaceBaseNameExact "." "thing" :: Maybe RelPath
--   Just thing
--   
--   >>> replaceBaseNameExact "/" "thing" :: Maybe AbsPath
--   Just /thing
--   
--   >>> replaceBaseNameExact "/directory/file" "" :: Maybe AbsPath
--   Nothing
--   
replaceBaseNameExact :: Path rel -> LastPathPiece -> Maybe (Path rel) -- | Replace the last piece -- --
--   >>> replaceBaseName "file.ext" "piece" :: RelPath
--   piece.ext
--   
--   >>> replaceBaseName "." "thing" :: RelPath
--   thing
--   
--   >>> replaceBaseName "/" "thing" :: AbsPath
--   /thing
--   
--   >>> replaceBaseName "/directory/file" "" :: AbsPath
--   /directory
--   
-- -- Replaces System.FilePath.replaceBaseName replaceBaseName :: Path rel -> LastPathPiece -> Path rel -- | Replace everthing but the last piece, exactly -- --
--   >>> replaceDirectoryExact ("/dir/and/file" :: AbsPath) ("other/directory" :: RelPath)
--   Just other/directory/file
--   
-- -- This will evaluate to Nothing if the first argument is an empty -- path. -- --
--   >>> replaceDirectoryExact ("." :: RelPath) ("a/directory" :: RelPath)
--   Nothing
--   
--   >>> replaceDirectoryExact ("/" :: AbsPath) ("a/directory" :: RelPath)
--   Nothing
--   
-- -- This will evaluate to Nothing if the second argument is an -- empty path. -- --
--   >>> replaceDirectoryExact ("dir/file" :: RelPath) ("." :: RelPath)
--   Nothing
--   
--   >>> replaceDirectoryExact ("dir/file" :: RelPath) ("/" :: AbsPath)
--   Nothing
--   
replaceDirectoryExact :: Path r -> Path s -> Maybe (Path s) -- | Replace everthing but the last piece -- --
--   >>> replaceDirectory ("/dir/and/file" :: AbsPath) ("other/directory" :: RelPath)
--   other/directory/file
--   
--   >>> replaceDirectory ("." :: RelPath) ("a/directory" :: RelPath)
--   a/directory
--   
--   >>> replaceDirectory ("/" :: AbsPath) ("a/directory" :: RelPath)
--   a/directory
--   
--   >>> replaceDirectory ("dir/file" :: RelPath) ("." :: RelPath)
--   file
--   
--   >>> replaceDirectory ("dir/file" :: RelPath) ("/" :: AbsPath)
--   /file
--   
-- -- Replaces System.FilePath.replaceDirectory replaceDirectory :: Path r -> Path s -> Path s -- | Combine two paths, exactly -- -- If the first path has extensions, they will be appended to the last -- pathpiece before concatenation -- --
--   >>> combineExact "/directory/path" "another/path.ext" :: Maybe AbsPath
--   Just /directory/path/another/path.ext
--   
--   >>> combineExact "directory/path"  "another/path.ext" :: Maybe RelPath
--   Just directory/path/another/path.ext
--   
--   >>> combineExact "/file.ext1.ext2" "other/file.ext3"  :: Maybe AbsPath
--   Just /file.ext1.ext2/other/file.ext3
--   
--   >>> combineExact "file.ext1.ext2"  "other/file.ext3"  :: Maybe RelPath
--   Just file.ext1.ext2/other/file.ext3
--   
-- -- This evaluates to Nothing if any of the given paths are empty -- --
--   >>> combineExact "." "file.ext" :: Maybe RelPath
--   Nothing
--   
--   >>> combineExact "/" "file.ext" :: Maybe AbsPath
--   Nothing
--   
combineExact :: Path rel -> RelPath -> Maybe (Path rel) -- | Combine two paths -- -- If the first path has extensions, they will be appended to the last -- pathpiece before concatenation -- --
--   >>> combine "/directory/path" "another/path.ext" :: AbsPath
--   /directory/path/another/path.ext
--   
--   >>> combine "directory/path"  "another/path.ext" :: RelPath
--   directory/path/another/path.ext
--   
--   >>> combine "/file.ext1.ext2" "other/file.ext3"  :: AbsPath
--   /file.ext1.ext2/other/file.ext3
--   
--   >>> combine "file.ext1.ext2"  "other/file.ext3"  :: RelPath
--   file.ext1.ext2/other/file.ext3
--   
-- -- This treats empty paths as identities to the operation. -- --
--   >>> combine "file.ext" "." :: RelPath
--   file.ext
--   
--   >>> combine "." "file.ext" :: RelPath
--   file.ext
--   
--   >>> combine "/" "file.ext" :: AbsPath
--   /file.ext
--   
--   >>> combine "." "." :: RelPath
--   .
--   
--   >>> combine "/" "." :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.combine combine :: Path rel -> RelPath -> Path rel -- | Combine two paths -- -- equivalent to combine -- --
--   >>> "/directory/path" </> "another/path.ext" :: AbsPath
--   /directory/path/another/path.ext
--   
--   >>> "directory/path"  </> "another/path.ext" :: RelPath
--   directory/path/another/path.ext
--   
--   >>> "/file.ext1.ext2" </> "other/file.ext3"  :: AbsPath
--   /file.ext1.ext2/other/file.ext3
--   
--   >>> "file.ext1.ext2"  </> "other/file.ext3"  :: RelPath
--   file.ext1.ext2/other/file.ext3
--   
--   >>> "." </> "file.ext" :: RelPath
--   file.ext
--   
--   >>> "/" </> "file.ext" :: AbsPath
--   /file.ext
--   
-- -- Replaces System.FilePath.(/) () :: Path rel -> RelPath -> Path rel -- | Split a path up into pieces -- --
--   >>> splitPath ("/a/full/absolute/directory/path" :: AbsPath)
--   [a,full,absolute,directory,path]
--   
splitPath :: Path rel -> [PathPiece] -- | Join path pieces back into a path -- --
--   >>> joinPath ["a", "full", "absolute", "directory", "path"] :: Maybe AbsPath
--   Just /a/full/absolute/directory/path
--   
--   >>> joinPath [] :: Maybe RelPath
--   Just .
--   
--   >>> joinPath [] :: Maybe AbsPath
--   Just /
--   
--   >>> joinPath [".", "."] :: Maybe RelPath
--   Nothing
--   
joinPath :: [PathPiece] -> Maybe (Path rel) initMay :: [a] -> Maybe [a] lastMay :: [a] -> Maybe a unsnoc :: [a] -> Maybe ([a], a) uncons :: [a] -> Maybe (a, [a]) isEmptyLastPathPiece :: LastPathPiece -> Bool emptyLastPathPiece :: LastPathPiece emptyPath :: Path rel isEmptyPath :: Path rel -> Bool renderPiece :: PathPiece -> String renderLastPiece :: LastPathPiece -> String renderExtension :: Extension -> String renderExtensions :: [Extension] -> String combineLastAndExtensions :: LastPathPiece -> [Extension] -> PathPiece splitPiece :: PathPiece -> (LastPathPiece, [Extension]) unsafePathTypeCoerse :: Path rel -> Path rel' instance Data.Data.Data rel => Data.Data.Data (Data.Path.Internal.Path rel) instance GHC.Generics.Generic (Data.Path.Internal.Path rel) instance GHC.Classes.Eq (Data.Path.Internal.Path rel) instance GHC.Show.Show (Data.Path.Internal.Path rel) instance Data.Data.Data Data.Path.Internal.Extension instance GHC.Generics.Generic Data.Path.Internal.Extension instance GHC.Classes.Eq Data.Path.Internal.Extension instance Data.Data.Data Data.Path.Internal.LastPathPiece instance GHC.Generics.Generic Data.Path.Internal.LastPathPiece instance GHC.Classes.Eq Data.Path.Internal.LastPathPiece instance Data.Data.Data Data.Path.Internal.PathPiece instance GHC.Generics.Generic Data.Path.Internal.PathPiece instance GHC.Classes.Eq Data.Path.Internal.PathPiece instance Data.Data.Data Data.Path.Internal.Relative instance GHC.Generics.Generic Data.Path.Internal.Relative instance Data.Data.Data Data.Path.Internal.Absolute instance GHC.Generics.Generic Data.Path.Internal.Absolute instance GHC.Show.Show (Data.Path.Internal.Path Data.Path.Internal.Relative) instance GHC.Show.Show (Data.Path.Internal.Path Data.Path.Internal.Absolute) instance Data.String.IsString (Data.Path.Internal.Path Data.Path.Internal.Absolute) instance Data.String.IsString (Data.Path.Internal.Path Data.Path.Internal.Relative) instance Data.Validity.Validity (Data.Path.Internal.Path rel) instance GHC.Show.Show Data.Path.Internal.PathPiece instance Data.Validity.Validity Data.Path.Internal.PathPiece instance Data.String.IsString Data.Path.Internal.PathPiece instance GHC.Show.Show Data.Path.Internal.LastPathPiece instance Data.Validity.Validity Data.Path.Internal.LastPathPiece instance Data.String.IsString Data.Path.Internal.LastPathPiece instance GHC.Show.Show Data.Path.Internal.Extension instance Data.String.IsString Data.Path.Internal.Extension instance Data.Validity.Validity Data.Path.Internal.Extension module Data.Path data Path rel type AbsPath = Path Absolute type RelPath = Path Relative data Absolute data Relative data PathPiece data LastPathPiece data Extension -- | Construct a relative path from a FilePath, failing if the given -- FilePath does not represent a valid relative path. -- --
--   >>> relpath "file"
--   Just file
--   
--   >>> relpath "/file"
--   Nothing
--   
--   >>> relpath "."
--   Just .
--   
--   >>> relpath "/"
--   Nothing
--   
--   >>> relpath ""
--   Nothing
--   
relpath :: FilePath -> Maybe RelPath -- | Construct an absolute path from a FilePath, failing if the -- given FilePath does not represent a valid absolute path. -- --
--   >>> abspath "/file"
--   Just /file
--   
--   >>> abspath "file"
--   Nothing
--   
--   >>> abspath "/"
--   Just /
--   
--   >>> abspath "."
--   Nothing
--   
--   >>> abspath ""
--   Nothing
--   
abspath :: FilePath -> Maybe AbsPath -- | Construct an extension safely -- --
--   >>> ext "extension"
--   Just extension
--   
--   >>> ext ".ext"
--   Nothing
--   
--   >>> ext ""
--   Nothing
--   
ext :: String -> Maybe Extension -- | Ground a filepath on an absolute path. This will try to parse the -- given FilePath as an absolute path and take it if that works. -- Otherwise it will try to parse it an a relative path and append it to -- the given AbsPath -- --
--   >>> ground "/home/user" "relative/path"
--   Just /home/user/relative/path
--   
--   >>> ground "/home/user" "/absolute/path"
--   Just /absolute/path
--   
--   >>> ground "/home/user" "."
--   Just /home/user
--   
--   >>> ground "/home/user" "/"
--   Just /
--   
--   >>> ground "/" "."
--   Just /
--   
--   >>> ground "/anything" ""
--   Nothing
--   
ground :: AbsPath -> FilePath -> Maybe AbsPath -- | Construct a relative path, throwing an error if relpath -- would fail. unsafeRelPathError :: FilePath -> RelPath -- | Construct an absolute path, throwing an error if abspath -- would fail. unsafeAbsPathError :: FilePath -> AbsPath -- | Construct an extension, throwing an error if pathpiece -- would fail. unsafePathPieceError :: String -> PathPiece -- | Construct an extension, throwing an error if lastpiece -- would fail. unsafeLastPieceError :: String -> LastPathPiece -- | Construct an extension, throwing an error if ext would -- fail. unsafeExtError :: String -> Extension -- | Render a relative filepath to a FilePath toRelFilePath :: RelPath -> FilePath -- | Render an absolute filepath to a FilePath toAbsFilePath :: AbsPath -> FilePath -- | Take the last extension of a filepath -- --
--   >>> takeExtension ("/directory/path.ext" :: AbsPath)
--   Just ext
--   
--   >>> takeExtension ("file.tar.gz" :: RelPath)
--   Just gz
--   
--   >>> takeExtension ("file" :: RelPath)
--   Nothing
--   
-- -- Replaces System.FilePath.takeExtension takeExtension :: Path rel -> Maybe Extension -- | Take all extensions of a given path in the form of a list -- --
--   >>> takeExtensions ("/directory/path.ext" :: AbsPath)
--   [ext]
--   
--   >>> takeExtensions ("file.tar.gz" :: RelPath)
--   [tar,gz]
--   
-- -- Replaces System.FilePath.takeExtensions takeExtensions :: Path rel -> [Extension] -- | Add an extension to a path -- --
--   >>> addExtension "/directory/path" "ext" :: AbsPath
--   /directory/path.ext
--   
--   >>> addExtension "directory/path"  "ext" :: RelPath
--   directory/path.ext
--   
-- -- This will not override the extension if there already is an extension. -- It will only add the given extension on top of it -- --
--   >>> addExtension "/directory/path.ext1" "ext2" :: AbsPath
--   /directory/path.ext1.ext2
--   
--   >>> addExtension "directory/path.ext1"  "ext2" :: RelPath
--   directory/path.ext1.ext2
--   
-- -- This will not add an extension if the path is empty. -- --
--   >>> addExtension "." "ext" :: RelPath
--   .
--   
--   >>> addExtension "/" "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.addExtension addExtension :: Path rel -> Extension -> Path rel -- | Add an extension to a path (equivalent to addExtension) -- --
--   >>> "/directory/path" <.> "ext" :: AbsPath
--   /directory/path.ext
--   
--   >>> "directory/path"  <.> "ext" :: RelPath
--   directory/path.ext
--   
--   >>> "/directory/path.ext1" <.> "ext2" :: AbsPath
--   /directory/path.ext1.ext2
--   
--   >>> "directory/path.ext1"  <.> "ext2" :: RelPath
--   directory/path.ext1.ext2
--   
--   >>> "." <.> "ext" :: RelPath
--   .
--   
--   >>> "/" <.> "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.(.) (<.>) :: Path rel -> Extension -> Path rel -- | Add a list of extensions to a path -- --
--   >>> addExtensions "/directory/path" ["ext1", "ext2"] :: AbsPath
--   /directory/path.ext1.ext2
--   
--   >>> addExtensions "directory/path"  ["ext1", "ext2"] :: RelPath
--   directory/path.ext1.ext2
--   
-- --
--   >>> addExtensions "/directory/path.ext1" ["ext2", "ext3"] :: AbsPath
--   /directory/path.ext1.ext2.ext3
--   
--   >>> addExtensions "directory/path.ext1"  ["ext2", "ext3"] :: RelPath
--   directory/path.ext1.ext2.ext3
--   
-- --
--   >>> addExtensions "." ["ext1", "ext2"] :: RelPath
--   .
--   
--   >>> addExtensions "/" ["ext1", "ext2"] :: AbsPath
--   /
--   
-- -- This operation is an identity function if the given list of extensions -- is empty. addExtensions :: Path rel -> [Extension] -> Path rel -- | Drop the last extension of a path, exactly -- -- This will fail if the given path has no extensions -- --
--   >>> dropExtensionExact "dir/file.ext1.ext2" :: Maybe RelPath
--   Just dir/file.ext1
--   
--   >>> dropExtensionExact "dir/file.ext" :: Maybe RelPath
--   Just dir/file
--   
--   >>> dropExtensionExact "dir/file" :: Maybe RelPath
--   Nothing
--   
--   >>> dropExtensionExact "/dir/file.ext1.ext2" :: Maybe AbsPath
--   Just /dir/file.ext1
--   
--   >>> dropExtensionExact "/dir/file.ext" :: Maybe AbsPath
--   Just /dir/file
--   
--   >>> dropExtensionExact "/dir/file" :: Maybe AbsPath
--   Nothing
--   
--   >>> dropExtensionExact "." :: Maybe RelPath
--   Nothing
--   
--   >>> dropExtensionExact "/" :: Maybe AbsPath
--   Nothing
--   
dropExtensionExact :: Path rel -> Maybe (Path rel) -- | Drop the last extension of a path -- --
--   >>> dropExtension "dir/file.ext1.ext2" :: RelPath
--   dir/file.ext1
--   
--   >>> dropExtension "dir/file.ext" :: RelPath
--   dir/file
--   
--   >>> dropExtension "dir/file" :: RelPath
--   dir/file
--   
--   >>> dropExtension "/dir/file.ext1.ext2" :: AbsPath
--   /dir/file.ext1
--   
--   >>> dropExtension "/dir/file.ext" :: AbsPath
--   /dir/file
--   
--   >>> dropExtension "/dir/file" :: AbsPath
--   /dir/file
--   
--   >>> dropExtension "." :: RelPath
--   .
--   
--   >>> dropExtension "/" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.dropExtension dropExtension :: Path rel -> Path rel -- | Drop all extensions of a path -- --
--   >>> dropExtensions "dir/file.ext1.ext2" :: RelPath
--   dir/file
--   
--   >>> dropExtensions "dir/file.ext" :: RelPath
--   dir/file
--   
--   >>> dropExtensions "dir/file" :: RelPath
--   dir/file
--   
--   >>> dropExtensions "/dir/file.ext1.ext2" :: AbsPath
--   /dir/file
--   
--   >>> dropExtensions "/dir/file.ext" :: AbsPath
--   /dir/file
--   
--   >>> dropExtensions "/dir/file" :: AbsPath
--   /dir/file
--   
--   >>> dropExtensions "." :: RelPath
--   .
--   
--   >>> dropExtensions "/" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.dropExtensions dropExtensions :: Path rel -> Path rel -- | Replace the last extension of a path, exactly -- -- This will fail if the given path has no extension -- --
--   >>> replaceExtensionExact "dir/file.ext1.ext2"  "ext3" :: Maybe RelPath
--   Just dir/file.ext1.ext3
--   
--   >>> replaceExtensionExact "dir/file.ext1"       "ext2" :: Maybe RelPath
--   Just dir/file.ext2
--   
--   >>> replaceExtensionExact "dir/file"            "ext"  :: Maybe RelPath
--   Nothing
--   
--   >>> replaceExtensionExact "/dir/file.ext1.ext2" "ext3" :: Maybe AbsPath
--   Just /dir/file.ext1.ext3
--   
--   >>> replaceExtensionExact "/dir/file.ext1"      "ext2" :: Maybe AbsPath
--   Just /dir/file.ext2
--   
--   >>> replaceExtensionExact "/dir/file"           "ext"  :: Maybe AbsPath
--   Nothing
--   
--   >>> replaceExtensionExact "." "ext" :: Maybe RelPath
--   Nothing
--   
--   >>> replaceExtensionExact "/" "ext" :: Maybe AbsPath
--   Nothing
--   
replaceExtensionExact :: Path rel -> Extension -> Maybe (Path rel) -- | Replace the last extension of a path -- -- This will first remove one extension and then add the given extension. -- --
--   replaceExtension path extension = dropExtension path <.> extension
--   
-- --
--   >>> replaceExtension "dir/file.ext1.ext2"  "ext3" :: RelPath
--   dir/file.ext1.ext3
--   
--   >>> replaceExtension "dir/file.ext1"       "ext2" :: RelPath
--   dir/file.ext2
--   
--   >>> replaceExtension "dir/file"            "ext"  :: RelPath
--   dir/file.ext
--   
--   >>> replaceExtension "/dir/file.ext1.ext2" "ext3" :: AbsPath
--   /dir/file.ext1.ext3
--   
--   >>> replaceExtension "/dir/file.ext1"      "ext2" :: AbsPath
--   /dir/file.ext2
--   
--   >>> replaceExtension "/dir/file"           "ext"  :: AbsPath
--   /dir/file.ext
--   
--   >>> replaceExtension "." "ext" :: RelPath
--   .
--   
--   >>> replaceExtension "/" "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.replaceExtension replaceExtension :: Path rel -> Extension -> Path rel -- | Replace the last extension of a path (equivalent to -- replaceExtension) -- --
--   >>> "dir/file.ext1.ext2" -<.> "ext3"   :: RelPath
--   dir/file.ext1.ext3
--   
--   >>> "dir/file.ext1" -<.> "ext2"        :: RelPath
--   dir/file.ext2
--   
--   >>> "dir/file" -<.> "ext"              :: RelPath
--   dir/file.ext
--   
--   >>> "/dir/file.ext1.ext2" -<.> "ext3"  :: AbsPath
--   /dir/file.ext1.ext3
--   
--   >>> "/dir/file.ext1" -<.> "ext2"       :: AbsPath
--   /dir/file.ext2
--   
--   >>> "/dir/file" -<.> "ext"             :: AbsPath
--   /dir/file.ext
--   
--   >>> "." -<.> "ext" :: RelPath
--   .
--   
--   >>> "/" -<.> "ext" :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.(-.) (-<.>) :: Path rel -> Extension -> Path rel -- | Replace all the extensions of a path with the given extension -- --
--   >>> replaceExtensions "dir/file.ext1.ext2"  "ext3" :: RelPath
--   dir/file.ext3
--   
--   >>> replaceExtensions "dir/file.ext1"       "ext3" :: RelPath
--   dir/file.ext3
--   
--   >>> replaceExtensions "dir/file"            "ext3" :: RelPath
--   dir/file.ext3
--   
--   >>> replaceExtensions "/dir/file.ext1.ext2" "ext3" :: AbsPath
--   /dir/file.ext3
--   
--   >>> replaceExtensions "/dir/file.ext1"      "ext3" :: AbsPath
--   /dir/file.ext3
--   
--   >>> replaceExtensions "/dir/file"           "ext3" :: AbsPath
--   /dir/file.ext3
--   
--   >>> replaceExtensions "." "ext" :: RelPath
--   .
--   
--   >>> replaceExtensions "/" "ext" :: AbsPath
--   /
--   
replaceExtensions :: Path rel -> Extension -> Path rel -- | Replace all the extensions of a path with the given list of extensions -- --
--   >>> replaceExtensionss "dir/file.ext1.ext2"  ["ext3", "ext4"] :: RelPath
--   dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "dir/file.ext1"       ["ext3", "ext4"] :: RelPath
--   dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "dir/file"            ["ext3", "ext4"] :: RelPath
--   dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "/dir/file.ext1.ext2" ["ext3", "ext4"] :: AbsPath
--   /dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "/dir/file.ext1"      ["ext3", "ext4"] :: AbsPath
--   /dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "/dir/file"           ["ext3", "ext4"] :: AbsPath
--   /dir/file.ext3.ext4
--   
--   >>> replaceExtensionss "." ["ext1", "ext2"] :: RelPath
--   .
--   
--   >>> replaceExtensionss "/" ["ext1", "ext2"] :: AbsPath
--   /
--   
replaceExtensionss :: Path rel -> [Extension] -> Path rel -- | Drop the given extension from a FilePath. Fails if the FilePath does -- not have the given extension. -- --
--   >>> stripExtension "foo.x.hs.o" "o"    :: Maybe RelPath
--   Just foo.x.hs
--   
--   >>> stripExtension "foo.x.hs.o" "hs"   :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtension "a.b.c.d"    "d"    :: Maybe RelPath
--   Just a.b.c
--   
--   >>> stripExtension "foo.bar"    "baz"  :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtension "foobar"     "bar"  :: Maybe RelPath
--   Nothing
--   
-- -- Replaces System.FilePath.stripExtension stripExtension :: Path rel -> Extension -> Maybe (Path rel) -- | Drop the given extensions from a FilePath. Fails if the FilePath does -- not have all of the given extensions. -- --
--   >>> stripExtensions "foo.x.hs.o" ["hs", "o"]      :: Maybe RelPath
--   Just foo.x
--   
--   >>> stripExtensions "foo.x.hs.o" ["o", "hs"]      :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtensions "a.b.c.d"    ["c", "d"]       :: Maybe RelPath
--   Just a.b
--   
--   >>> stripExtensions "foo.bar"    ["baz", "quux"]  :: Maybe RelPath
--   Nothing
--   
--   >>> stripExtensions "foobar"     ["bar"]          :: Maybe RelPath
--   Nothing
--   
stripExtensions :: Path rel -> [Extension] -> Maybe (Path rel) -- | Split off the extensions from a path -- --
--   >>> splitExtension ("dir/file.ext1.ext2" :: RelPath)
--   Just (dir/file.ext1,ext2)
--   
--   >>> splitExtension ("dir/file.ext" :: RelPath)
--   Just (dir/file,ext)
--   
--   >>> splitExtension ("dir/file" :: RelPath)
--   Nothing
--   
--   >>> splitExtension ("/dir/file.ext1.ext2" :: AbsPath)
--   Just (/dir/file.ext1,ext2)
--   
--   >>> splitExtension ("/dir/file.ext" :: AbsPath)
--   Just (/dir/file,ext)
--   
--   >>> splitExtension ("/dir/file" :: AbsPath)
--   Nothing
--   
--   >>> splitExtension ("." :: RelPath)
--   Nothing
--   
--   >>> splitExtension ("/" :: AbsPath)
--   Nothing
--   
-- -- Replaces System.FilePath.splitExtension splitExtension :: Path rel -> Maybe (Path rel, Extension) -- | Split off the extensions from a path -- --
--   >>> splitExtensions ("dir/file.ext1.ext2" :: RelPath)
--   (dir/file,[ext1,ext2])
--   
--   >>> splitExtensions ("dir/file.ext" :: RelPath)
--   (dir/file,[ext])
--   
--   >>> splitExtensions ("dir/file" :: RelPath)
--   (dir/file,[])
--   
--   >>> splitExtensions ("/dir/file.ext1.ext2" :: AbsPath)
--   (/dir/file,[ext1,ext2])
--   
--   >>> splitExtensions ("/dir/file.ext" :: AbsPath)
--   (/dir/file,[ext])
--   
--   >>> splitExtensions ("/dir/file" :: AbsPath)
--   (/dir/file,[])
--   
--   >>> splitExtensions ("." :: RelPath)
--   (.,[])
--   
--   >>> splitExtensions ("/" :: AbsPath)
--   (/,[])
--   
splitExtensions :: Path rel -> (Path rel, [Extension]) -- | Check whether the given filepath has any extensions -- --
--   >>> hasExtension ("/directory/path.ext" :: AbsPath)
--   True
--   
--   >>> hasExtension ("/directory/path"     :: AbsPath)
--   False
--   
-- -- Replaces System.FilePath.hasExtension hasExtension :: Path rel -> Bool -- | Take the last piece and the extensions, exactly. -- -- This will evaluate to Nothing if the given path is empty -- --
--   >>> takeFileNameExact ("/directory/file.ext" :: AbsPath)
--   Just file.ext
--   
--   >>> takeFileNameExact ("file/bob.txt" :: RelPath)
--   Just bob.txt
--   
--   >>> takeFileNameExact ("file" :: RelPath)
--   Just file
--   
--   >>> takeFileNameExact ("dir.ext/file.ext" :: RelPath)
--   Just file.ext
--   
--   >>> takeFileNameExact ("." :: RelPath)
--   Nothing
--   
--   >>> takeFileNameExact ("/" :: AbsPath)
--   Nothing
--   
-- -- Replaces System.FilePath.takeFileName takeFileNameExact :: Path rel -> Maybe RelPath -- | Take the last piece and the extensions. -- -- This will evaluate to the empty (relative) path if the given path is -- empty. -- --
--   >>> takeFileName ("/directory/file.ext" :: AbsPath)
--   file.ext
--   
--   >>> takeFileName ("file/bob.txt" :: RelPath)
--   bob.txt
--   
--   >>> takeFileName ("file" :: RelPath)
--   file
--   
--   >>> takeFileName ("dir.ext/file.ext" :: RelPath)
--   file.ext
--   
--   >>> takeFileName ("." :: RelPath)
--   .
--   
--   >>> takeFileName ("/" :: AbsPath)
--   .
--   
-- -- Replaces System.FilePath.takeFileName takeFileName :: Path rel -> RelPath -- | Drop the last piece of a path, exactly -- --
--   >>> dropFileNameExact ("directory/file.ext" :: RelPath)
--   Just directory
--   
--   >>> dropFileNameExact ("/directory/file.ext" :: AbsPath)
--   Just /directory
--   
-- -- This evaluates to Nothing when given an empty path -- --
--   >>> dropFileNameExact ("/" :: AbsPath)
--   Nothing
--   
--   >>> dropFileNameExact ("." :: RelPath)
--   Nothing
--   
dropFileNameExact :: Path rel -> Maybe (Path rel) -- | Drop the last piece of a path -- --
--   >>> dropFileName ("directory/file.ext" :: RelPath)
--   directory
--   
--   >>> dropFileName ("/directory/file.ext" :: AbsPath)
--   /directory
--   
-- -- This evaluates to an empty path when given an empty path -- --
--   >>> dropFileName ("/" :: AbsPath)
--   /
--   
--   >>> dropFileName ("." :: RelPath)
--   .
--   
-- -- Replaces System.FilePath.dropFileName and -- System.FilePath.takeDirectory dropFileName :: Path rel -> Path rel -- | Replace the last piece of a path with the given last piece. -- --
--   >>> replaceFileNameExact "/directory/other.txt" "file.ext" :: Maybe AbsPath
--   Just /directory/file.ext
--   
--   >>> replaceFileNameExact "." "file.ext" :: Maybe RelPath
--   Just file.ext
--   
--   >>> replaceFileNameExact "/" "file.ext" :: Maybe AbsPath
--   Just /file.ext
--   
-- -- If the given path piece is degenerate, this is what happens: -- --
--   >>> replaceFileNameExact "/directory/other.txt" "..." :: Maybe AbsPath
--   Nothing
--   
replaceFileNameExact :: Path rel -> PathPiece -> Maybe (Path rel) -- | Replace the last piece of a path with the given last piece. -- --
--   >>> replaceFileName "/directory/other.txt" "file.ext" :: AbsPath
--   /directory/file.ext
--   
--   >>> replaceFileName "." "file.ext" :: RelPath
--   file.ext
--   
--   >>> replaceFileName "/" "file.ext" :: AbsPath
--   /file.ext
--   
-- -- If the given path piece is degenerate, this is what happens: -- --
--   >>> replaceFileName "/directory/other.txt" "..." :: AbsPath
--   /directory
--   
replaceFileName :: Path rel -> PathPiece -> Path rel -- | Take the last piece (no extensions) -- --
--   >>> takeBaseNameExact ("file.ext" :: RelPath)
--   Just file
--   
--   >>> takeBaseNameExact ("dir/and/file.ext" :: RelPath)
--   Just file
--   
-- -- This will evaluate to Nothing when given an empty path: -- --
--   >>> takeBaseNameExact ("." :: RelPath)
--   Nothing
--   
--   >>> takeBaseNameExact ("/" :: AbsPath)
--   Nothing
--   
takeBaseNameExact :: Path rel -> Maybe LastPathPiece -- | Take the last piece (no extensions) -- --
--   >>> takeBaseName ("file.ext" :: RelPath)
--   file
--   
--   >>> takeBaseName ("dir/and/file.ext" :: RelPath)
--   file
--   
-- -- This will evaluate to an empty last path piece when given an empty -- path: -- -- Replaces System.FilePath.takeBaseName takeBaseName :: Path rel -> LastPathPiece -- | Replace the last piece exactly: fails on empty last piece -- --
--   >>> replaceBaseNameExact "file.ext" "piece" :: Maybe RelPath
--   Just piece.ext
--   
--   >>> replaceBaseNameExact "." "thing" :: Maybe RelPath
--   Just thing
--   
--   >>> replaceBaseNameExact "/" "thing" :: Maybe AbsPath
--   Just /thing
--   
--   >>> replaceBaseNameExact "/directory/file" "" :: Maybe AbsPath
--   Nothing
--   
replaceBaseNameExact :: Path rel -> LastPathPiece -> Maybe (Path rel) -- | Replace the last piece -- --
--   >>> replaceBaseName "file.ext" "piece" :: RelPath
--   piece.ext
--   
--   >>> replaceBaseName "." "thing" :: RelPath
--   thing
--   
--   >>> replaceBaseName "/" "thing" :: AbsPath
--   /thing
--   
--   >>> replaceBaseName "/directory/file" "" :: AbsPath
--   /directory
--   
-- -- Replaces System.FilePath.replaceBaseName replaceBaseName :: Path rel -> LastPathPiece -> Path rel -- | Replace everthing but the last piece, exactly -- --
--   >>> replaceDirectoryExact ("/dir/and/file" :: AbsPath) ("other/directory" :: RelPath)
--   Just other/directory/file
--   
-- -- This will evaluate to Nothing if the first argument is an empty -- path. -- --
--   >>> replaceDirectoryExact ("." :: RelPath) ("a/directory" :: RelPath)
--   Nothing
--   
--   >>> replaceDirectoryExact ("/" :: AbsPath) ("a/directory" :: RelPath)
--   Nothing
--   
-- -- This will evaluate to Nothing if the second argument is an -- empty path. -- --
--   >>> replaceDirectoryExact ("dir/file" :: RelPath) ("." :: RelPath)
--   Nothing
--   
--   >>> replaceDirectoryExact ("dir/file" :: RelPath) ("/" :: AbsPath)
--   Nothing
--   
replaceDirectoryExact :: Path r -> Path s -> Maybe (Path s) -- | Replace everthing but the last piece -- --
--   >>> replaceDirectory ("/dir/and/file" :: AbsPath) ("other/directory" :: RelPath)
--   other/directory/file
--   
--   >>> replaceDirectory ("." :: RelPath) ("a/directory" :: RelPath)
--   a/directory
--   
--   >>> replaceDirectory ("/" :: AbsPath) ("a/directory" :: RelPath)
--   a/directory
--   
--   >>> replaceDirectory ("dir/file" :: RelPath) ("." :: RelPath)
--   file
--   
--   >>> replaceDirectory ("dir/file" :: RelPath) ("/" :: AbsPath)
--   /file
--   
-- -- Replaces System.FilePath.replaceDirectory replaceDirectory :: Path r -> Path s -> Path s -- | Combine two paths, exactly -- -- If the first path has extensions, they will be appended to the last -- pathpiece before concatenation -- --
--   >>> combineExact "/directory/path" "another/path.ext" :: Maybe AbsPath
--   Just /directory/path/another/path.ext
--   
--   >>> combineExact "directory/path"  "another/path.ext" :: Maybe RelPath
--   Just directory/path/another/path.ext
--   
--   >>> combineExact "/file.ext1.ext2" "other/file.ext3"  :: Maybe AbsPath
--   Just /file.ext1.ext2/other/file.ext3
--   
--   >>> combineExact "file.ext1.ext2"  "other/file.ext3"  :: Maybe RelPath
--   Just file.ext1.ext2/other/file.ext3
--   
-- -- This evaluates to Nothing if any of the given paths are empty -- --
--   >>> combineExact "." "file.ext" :: Maybe RelPath
--   Nothing
--   
--   >>> combineExact "/" "file.ext" :: Maybe AbsPath
--   Nothing
--   
combineExact :: Path rel -> RelPath -> Maybe (Path rel) -- | Combine two paths -- -- If the first path has extensions, they will be appended to the last -- pathpiece before concatenation -- --
--   >>> combine "/directory/path" "another/path.ext" :: AbsPath
--   /directory/path/another/path.ext
--   
--   >>> combine "directory/path"  "another/path.ext" :: RelPath
--   directory/path/another/path.ext
--   
--   >>> combine "/file.ext1.ext2" "other/file.ext3"  :: AbsPath
--   /file.ext1.ext2/other/file.ext3
--   
--   >>> combine "file.ext1.ext2"  "other/file.ext3"  :: RelPath
--   file.ext1.ext2/other/file.ext3
--   
-- -- This treats empty paths as identities to the operation. -- --
--   >>> combine "file.ext" "." :: RelPath
--   file.ext
--   
--   >>> combine "." "file.ext" :: RelPath
--   file.ext
--   
--   >>> combine "/" "file.ext" :: AbsPath
--   /file.ext
--   
--   >>> combine "." "." :: RelPath
--   .
--   
--   >>> combine "/" "." :: AbsPath
--   /
--   
-- -- Replaces System.FilePath.combine combine :: Path rel -> RelPath -> Path rel -- | Combine two paths -- -- equivalent to combine -- --
--   >>> "/directory/path" </> "another/path.ext" :: AbsPath
--   /directory/path/another/path.ext
--   
--   >>> "directory/path"  </> "another/path.ext" :: RelPath
--   directory/path/another/path.ext
--   
--   >>> "/file.ext1.ext2" </> "other/file.ext3"  :: AbsPath
--   /file.ext1.ext2/other/file.ext3
--   
--   >>> "file.ext1.ext2"  </> "other/file.ext3"  :: RelPath
--   file.ext1.ext2/other/file.ext3
--   
--   >>> "." </> "file.ext" :: RelPath
--   file.ext
--   
--   >>> "/" </> "file.ext" :: AbsPath
--   /file.ext
--   
-- -- Replaces System.FilePath.(/) () :: Path rel -> RelPath -> Path rel -- | Split a path up into pieces -- --
--   >>> splitPath ("/a/full/absolute/directory/path" :: AbsPath)
--   [a,full,absolute,directory,path]
--   
splitPath :: Path rel -> [PathPiece] -- | Join path pieces back into a path -- --
--   >>> joinPath ["a", "full", "absolute", "directory", "path"] :: Maybe AbsPath
--   Just /a/full/absolute/directory/path
--   
--   >>> joinPath [] :: Maybe RelPath
--   Just .
--   
--   >>> joinPath [] :: Maybe AbsPath
--   Just /
--   
--   >>> joinPath [".", "."] :: Maybe RelPath
--   Nothing
--   
joinPath :: [PathPiece] -> Maybe (Path rel) pathSeparator :: Char pathSeparators :: [Char] -- | Check if a given character is a valid path separator -- --
--   >>> isPathSeparator pathSeparator
--   True
--   
--   >>> all isPathSeparator pathSeparators
--   True
--   
isPathSeparator :: Char -> Bool extensionSeparator :: Char extensionSeparators :: [Char] -- | Check if a given character is a valid extension separator -- --
--   >>> isExtensionSeparator extensionSeparator
--   True
--   
--   >>> all isExtensionSeparator extensionSeparators
--   True
--   
isExtensionSeparator :: Char -> Bool